I think your problem is to do with the fact that the current version of HTTPClient does not have proxy support for SSL connections. So when you try to connect to an HTTP server via a proxy server, the HTTP client actually makes an SSLSocket connection to the proxy server itself. But obviously since the proxy server does not know SSL protocol, the handshake won't go through and hence the exception. The same worked with HttpsURLConnection, since the default implementation does handle proxy tunnelling properly.
Try using your same code to connect to a server within your intranet and don't use the proxy server. It will work. Look at my earlier note on enabling proxy support on HTTPClient. You will need to rebuild the library. Regards, Sachin -----Original Message----- From: Chang Sau Sheong [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 12 June 2002 11:01 PM To: Jakarta Commons Developers List Subject: Re: HttpClient with HTTPS Thanks for the quick reply. I used the -Djava.protocol.handler.pkgs=com.sun.net.ssl.internal.www.protocol system properties to start up Tomcat (I used HttpClient in Tomcat) and when I was previously using URLConnection to do the same thing, it worked pretty well. I switched to using HttpClient because I needed the session and cookies support but I'm pretty stymied by this issue I have with SSL. Hoping for answers? Thanks! .sausheong ----- Original Message ----- From: "Evert Hoff" <[EMAIL PROTECTED]> To: "Jakarta Commons Developers List" <[EMAIL PROTECTED]> Sent: Wednesday, June 12, 2002 10:42 PM Subject: Re: HttpClient with HTTPS > Hi, > > You must set your system properties before you start using it with SSL. > Here's how: > > System.setProperty("java.protocol.handler.pkgs", > "com.sun.net.ssl.internal.www.protocol"); > Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); > > You need to import: > import com.sun.net.ssl.*; > import java.security.*; > > Regards, > > Evert > > On Wed, 2002-06-12 at 16:40, Chang Sau Sheong wrote: > > Hi, > > > > I've just starting using HttpClient recently -- great work -- but I've some > > problems with HTTPS connections. With the older alpha1 release dated October > > 2001, I get this exception: > > > > javax.net.ssl.SSLException: Unrecognized SSL handshake. > > at > > com.sun.net.ssl.internal.ssl.InputRecord.read([DashoPro-V1.2-120198]) > > at > > com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198]) > > at > > com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198]) > > at > > com.sun.net.ssl.internal.ssl.AppOutputStream.write([DashoPro-V1.2-120198]) > > at java.io.OutputStream.write(Unknown Source) > > at > > org.apache.commons.httpclient.HttpConnection.write(HttpConnection.java:363) > > at > > org.apache.commons.httpclient.HttpConnection.print(HttpConnection.java:433) > > at > > org.apache.commons.httpclient.HttpMethodBase.writeRequestLine(HttpMethodBase > > .java:715) > > at > > org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.jav > > a:692) > > > > With the latest nightly release (12 June 2002) I can't get a connection at > > all! > > > > java.net.ConnectException: Connection refused: connect > > at java.net.PlainSocketImpl.socketConnect(Native Method) > > at java.net.PlainSocketImpl.doConnect(Unknown Source) > > at java.net.PlainSocketImpl.connectToAddress(Unknown Source) > > at java.net.PlainSocketImpl.connect(Unknown Source) > > at java.net.Socket.<init>(Unknown Source) > > at java.net.Socket.<init>(Unknown Source) > > at javax.net.ssl.SSLSocket.<init>([DashoPro-V1.2-120198]) > > at > > com.sun.net.ssl.internal.ssl.SSLSocketImpl.<init>([DashoPro-V1.2-120198]) > > at > > com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket([DashoPro-V1. > > 2-120198]) > > at > > org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:284) > > at > > org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:466 > > ) > > at > > org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:320) > > > > Any ideas or tips? I read in the archive someone mentioning that SSL is not > > implemented in this release but I checked the source and it *looks* like it > > is implemented. Anyone with a clue? > > > > Thanks in advance! > > > > > > .sausheong > > > > > > > > > > > > -- > > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > > > > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
