.build();
final Integer chunkSize = ClientProperties.getValue(config.getProperties(),
ClientProperties.CHUNKED_ENCODING_SIZE, 4096, Integer.class);
final PoolingHttpClientConnectionManager connectionManager =
new PoolingHttpClientConnectionManager(registry, new ConnectionFactory(chunkSize));
if (useSystemProperties) {
String s = System.getProperty("http.keepAlive", "true");
if ("true".equalsIgnoreCase(s)) {
s = System.getProperty("http.maxConnections", "5");
final int max = Integer.parseInt(s);
connectionManager.setDefaultMaxPerRoute(max);
connectionManager.setMaxTotal(2 * max);
}
}
return connectionManager;
}