// TODO KKr - set on connection manager params, or client params?
CookieSpecParamBean cookieParams = new CookieSpecParamBean(params);
cookieParams.setSingleHeader(true);
// Create and initialize scheme registry
SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
SSLSocketFactory sf = null;
for (String contextName : SSL_CONTEXT_NAMES) {
try {
SSLContext sslContext = SSLContext.getInstance(contextName);
sslContext.init(null, new TrustManager[] { new DummyX509TrustManager(null) }, null);
sf = new SSLSocketFactory(sslContext);
break;
} catch (NoSuchAlgorithmException e) {
LOGGER.debug("SSLContext algorithm not available: " + contextName);
} catch (Exception e) {
LOGGER.debug("SSLContext can't be initialized: " + contextName, e);
}
}
if (sf != null) {
sf.setHostnameVerifier(new DummyX509HostnameVerifier());
schemeRegistry.register(new Scheme("https", sf, 443));
} else {
LOGGER.warn("No valid SSLContext found for https");
}
// Use ThreadSafeClientConnManager since more than one thread will be using the HttpClient.