private static Client makeClient(long requestTimeout, int maxConnections) {
ClientConfig clientConfig = new ClientConfig();
int castRequestTimeout = Ints.checkedCast(requestTimeout);
clientConfig.register(makeGZipFeature());
clientConfig.property(ClientProperties.ASYNC_THREADPOOL_SIZE, maxConnections);
clientConfig.property(ClientProperties.CONNECT_TIMEOUT, castRequestTimeout);
clientConfig.property(ClientProperties.READ_TIMEOUT, castRequestTimeout);
clientConfig.property(ApacheClientProperties.CONNECTION_MANAGER, makeConnectionManager(maxConnections));
clientConfig.connectorProvider(new ApacheConnectorProvider());
return ClientBuilder.newClient(clientConfig);