int serverPort, int timeout)
throws IOException
{
initSSLContext();
SSLSocketFactory factory = sslCtx.getSocketFactory();
SSLSocket socket = (SSLSocket)factory.createSocket();
socket.connect(new InetSocketAddress(serverAddr, serverPort), timeout);
String[] supportedProtocols = socket.getSupportedProtocols();
log.debug("Supported protocols: " + Arrays.asList(supportedProtocols));
String[] protocols = supportedProtocols; // {"SSLv3"};
socket.setEnabledProtocols(protocols);
socket.addHandshakeCompletedListener(this);
socket.setNeedClientAuth(needsClientAuth);
socket.setWantClientAuth(wantsClientAuth);
return socket;
}