Skip to content

Instantly share code, notes, and snippets.

@blackbird014
Created January 16, 2017 10:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blackbird014/cf04d60fca486acab7614c87263f12f7 to your computer and use it in GitHub Desktop.
Save blackbird014/cf04d60fca486acab7614c87263f12f7 to your computer and use it in GitHub Desktop.
final SSLContext sslContext = sslConfig.createSSLContext();
//final SSLContext sslContext = getSSLContext("C:/vwdtest.jks", "password");
//Configure client
ClientConfig clientConfig = new ClientConfig();
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create()
.register("http", PlainConnectionSocketFactory.getSocketFactory())
.register("https", new SSLConnectionSocketFactory(sslContext))
.build();
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();
connectionManager.setMaxTotal(100);
connectionManager.setDefaultMaxPerRoute(20);
clientConfig.property(ApacheClientProperties.CONNECTION_MANAGER, connectionManager);
clientConfig.connectorProvider(new ApacheConnectorProvider());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment