Created
January 16, 2017 10:02
-
-
Save blackbird014/cf04d60fca486acab7614c87263f12f7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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