Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Communicating with HTTPS server with Client Authentication

1 view
Skip to first unread message

shankar_jcp

unread,
Mar 22, 2004, 7:10:08 AM3/22/04
to
Hi,

I need to do a Client Authentication with the server running on HTTPS
(from a Java code).

First, I thought of connecting and reading to a HTTPS server and try
Client Authentication later.

I failed in the first step itself. I could not connect to
https://mail.yahoo.com . It throws an the following error..
NOTE: I could get the connection and read the content of the server
running my company's internal network using the below code.

Please let me know if you guys have any idead about this one and also for
doing the Client Authentication

java.util.NoSuchElementException
at java.util.StringTokenizer.nextToken(StringTokenizer.java:232)
at
sun.net.www.protocol.http.HttpURLConnection.doTunneling(HttpURLConnection.java:768)
at
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(DashoA6275)
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:562)
at
sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(DashoA6275)
at Test.main(Test.java:19)
Exception in thread "main"

import java.io.*;
import java.net.*;
import javax.net.ssl.*;

public class Test {
public static void main(String args[]) throws Exception {

System.setProperty("https.proxyHost", "ghqproxy1.is.ge.com");
System.setProperty("https.proxyPort", "80");

URL url = new URL("https://www.entrust.com/");
URLConnection conn = url.openConnection();
HttpsURLConnection urlConn = (HttpsURLConnection) conn;
BufferedReader in = new BufferedReader(new
InputStreamReader(urlConn.getInputStream()));

String str;
while( (str=in.readLine()) != null) {
System.out.println(str);
}
}
}


0 new messages