scalecube/socketio

Server doesn't work with SSlcontext

mabuonomo opened this issue · 3 comments

Hi, this my code:

KeyStore ks = KeyStore.getInstance("jks");
ks.load(new FileInputStream(keystore), keystore_password);
KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance("SunX509");
keyManagerFactory.init(ks, "mypass".toCharArray());
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init(ks);
SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init(keyManagerFactory.getKeyManagers(), tmf.getTrustManagers(), null);
SSLContext.setDefault(sslContext);

// Start server
SocketIOServer logServer = SocketIOServer.newInstance(5001, sslContext);
logServer.start();

The server is started (isStarted is true), no error, no warning, but doens't work. It doesn't respond to telnet on port 5001.
Without ssl it works normally.

@SharkSoft Hi,

Could you please try previous release version 2.3.0 it may be that some issue related to changes introduced recently. Also can you check what is returned by debugging SSL handshake, for example run following command:

OpenSSL s_client -connect localhost:4815 -prexit

@SharkSoft Hi again,

I have updated socket.io examples with loading SSL context from file, which is pretty much the same code as you provided above:

https://github.com/scalecube/socketio-examples/blob/master/src/main/java/io/scalecube/socketio/examples/server/SslServerLauncher.java

And also I am using demo client at http://scalecube.io/socketio/ to connect localhost:4815
(Take note that in order to make it work in web browser you I need to open https://localhost:4815/socket.io/1/ and accept self-signed SSL certificate). And basically I have successfully established SSL connection.

So you may check your keystore file either it is valid or maybe provide some more details how to reproduce the issue.

Hi @antonkharenko, thanks for your reply,
Your example work well (last socket.io 2.3.1), you can close this topic.

Thank you