jessie-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Jessie-discuss] Wrapping a Socket as SSLSocket (Was: Bug when closi


From: Martin Egholm Nielsen
Subject: Re: [Jessie-discuss] Wrapping a Socket as SSLSocket (Was: Bug when closing stream)
Date: Thu, 14 Jul 2005 10:50:44 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.6) Gecko/20050319

Hi again,

Haven't quite had any success with this yet...

--- 8< 8< 8< ---
But then there is no way to kick an ongoing client connection?

Yes, you can forcibly close the underlying TCP socket. The JSSE API lets you wrap an existing socket with an SSL layer, and you can close that socket if you need to.

I meant you should use 'java.net.ServerSocket.accept()' to get a plain TCP socket, then call 'javax.net.ssl.SSLSocketFactory.createSocket (Socket,String,int,boolean)' to wrap that socket with an SSL layer. You can then call 'close()' on the plain socket if you need to.

Aaah, clever clever! I'll do that - and wrap the wrapped socket in a new Socket wrapper for passing the close() to the real Socket, but the rest to the SSLSocket.

I tried this...
I configured my SSLContext as before, used an ordinary ServerSocket for accept(), and then wrapped that socket in a SSLSocket using the configured SSLContext for returning a SSLSocketFactory:

Socket s = ss.accept();
sslc.getSocketFactory().createSocket( s, "blah", 443, true );

Connecting to my server from Mozilla I now get an error:

SSL_ERROR_RX_UNEXPECTED_CLIENT_HELLO -12246 "SSL received an unexpected Client Hello handshake message."

So it looks like the SSLSocket thinks its a client... Is there a way to configure this?

BR,
 Martin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]