Code example for SSLSocketFactory

Methods: createSocket

0
    public abstract SSLSocket attachSSLConnection(Socket socket, String host, int port) throws IOException; 
 
    final static SSLConnector defaultConnector = new SSLConnector() { 
        public SSLSocket attachSSLConnection(Socket socket, String host, int port) throws IOException { 
            SSLSocketFactory factory = (SSLSocketFactory) SSLSocketFactory.getDefault(); 
            return (SSLSocket) factory.createSocket(socket, host, port, true); 
        } 
    }; 
 
    /** Return the default SSLConnector, using SSLSocketFactory.getDefault. */ 
    static public SSLConnector getDefault() { 
        return defaultConnector; 
    } 
};