public static SocketTransport connect ( InetSocketAddress address , X509Certificate pinnedcert ) throws IOException { SSLSocketFactory factory = get_ssl_socket_factory ( pinnedcert ) ; Socket s = factory . createSocket ( address . getHostString ( ) , address . getPort ( ) ) ; return new SocketTransport ( s ) ; }
Connects to the mentioned host and port with SSL and checks the certificate against the pinned version .