Code example for SSLContext

Methods: getSocketFactory

0
	        sslContext.init(null, new TrustManager[] { tm }, null);
	    } 
 
	    @Override 
	    public Socket createSocket(Socket socket, String host, int port, boolean autoClose) throws IOException, UnknownHostException {
	        return sslContext.getSocketFactory().createSocket(socket, host, port, autoClose);
	    } 
 
	    @Override 
	    public Socket createSocket() throws IOException {
	        return sslContext.getSocketFactory().createSocket();
	    } 
	} 
 
	// Our own HttpClient that uses the SSLSocketFactory above and modifies a few params 
	public HttpClient getNewHttpClient() {
	    try { 
	        KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
	        trustStore.load(null, null);
 
	        SSLSocketFactory sf = new MySSLSocketFactory(trustStore);