Object next = ObjectHelper.getIdentityHashCode(sslContextParams);
throw new IllegalArgumentException("Only same instance of SSLContextParameters is supported. Cannot use a different instance."
+ " Previous instance hashcode: " + previous + ", New instance hashcode: " + next);
}
SchemeRegistry registry = clientConnectionManager.getSchemeRegistry();
if (secure) {
SSLSocketFactory socketFactory;
if (sslContextParams == null) {
socketFactory = SSLSocketFactory.getSocketFactory();
} else {
socketFactory = new SSLSocketFactory(sslContextParams.createSSLContext());
}
socketFactory.setHostnameVerifier(x509HostnameVerifier);
// must register both https and https4
registry.register(new Scheme("https", port, socketFactory));
LOG.info("Registering SSL scheme https on port " + port);
registry.register(new Scheme("https4", port, socketFactory));
LOG.info("Registering SSL scheme https4 on port " + port);
} else {
// must register both http and http4
registry.register(new Scheme("http", port, new PlainSocketFactory()));
LOG.info("Registering PLAIN scheme http on port " + port);
registry.register(new Scheme("http4", port, new PlainSocketFactory()));
LOG.info("Registering PLAIN scheme http4 on port " + port);
}
}