commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Evert Hoff <evert.h...@pixie.co.za>
Subject Re: HttpClient with HTTPS
Date Wed, 12 Jun 2002 14:42:12 GMT
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:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>
> 




--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message