CrazyEric CrazyEric - 3 months ago 16
Linux Question

What's the difference between Windows and Linux/OS X when using the Java SSLSocket?

I wrote a multi-server chat system based on Java under Windows. At the security part, I created one keystore to create the SSLSocket. When I launch 3 servers, it works on Windows(Win10 14393.321) but fails on OS X(Version 10.12 (16A323)) and Linux(Ubuntu 14.04.4 LTS). It really confused me. Here is the keystore part:

System.setProperty("", "password");

And when I run the third server on OS X or Linux, it shows: Connection refused

at Method) at
at at at at at
at server.AuthorizeServer.MessageReceive( at
server.AuthorizeServer.main( at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
at java.lang.reflect.Method.invoke( at

This is my first time asking on StackOverflow and I really looking forward to your kind help.

Answer Connection refused

Connection refused is an error message from the TCP stack and means that it could not connect with TCP to the other side. Since SSL/TLS is a layer on top of TCP and is only started once the TCP connect succeeded it means that the problem is not caused by different behavior at the SSL/TLS layer.

That this is not cause by the SSL layer but the TCP layer can also be seen by the stacktrace: Connection refused at

More likely is that there is something blocking the TCP connection (firewall) or that you've tried to listen/connect to the wrong IP address (e.g. trying to reach a server listening on on Windows from the Linux system). But is impossible to say from the currently provided information what exactly is the case.