// configure caching
CacheConfig cacheConfig = CacheConfig.copy(CacheConfig.DEFAULT).setSharedCache(false).setMaxCacheEntries(1000)
.setMaxObjectSize(2 * 1024 * 1024).build();
// configure connection pooling
PoolingHttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager();
int connectionLimit = readFromProperty("bdMaxConnections", 40);
// there's only one server to connect to, so max per route matters
connManager.setMaxTotal(connectionLimit);
connManager.setDefaultMaxPerRoute(connectionLimit);
// create the HTTP client
return CachingHttpClientBuilder.create().setCacheConfig(cacheConfig).setSslcontext(sslContext)
.setDefaultRequestConfig(requestConfig).setConnectionManager(connManager).build();
} catch (GeneralSecurityException e) {