public Socket connect(String host, int port) throws NoSuchAlgorithmException, KeyManagementException, IOException { SocketFactory ss = getLevel().find(SocketFactory.class); Socket s = ss.createSocket(host, port); SSLSocketFactory ssf = getContext().getSocketFactory(); s = ssf.createSocket(s, host, port, true); log(Level.DEBUG, "done SSL handshake for %s", host); return s; }