protected void initHttpClient(HttpClientConfig config) {
        HostConfiguration hostConfiguration = new HostConfiguration();
        hostConfiguration.setHost(config.getHost(), config.getPort());

        connectionManager = new MultiThreadedHttpConnectionManager();
        connectionManager.closeIdleConnections(config.getPollingIntervalTime() * 4000);

        HttpConnectionManagerParams params = new HttpConnectionManagerParams();
        params.setStaleCheckingEnabled(config.isConnectionStaleCheckingEnabled());
        params.setMaxConnectionsPerHost(hostConfiguration, config.getMaxHostConnections());
        params.setMaxTotalConnections(config.getMaxTotalConnections());
        params.setConnectionTimeout(config.getTimeout());
        params.setSoTimeout(60 * 1000);

        connectionManager.setParams(params);
        httpclient = new HttpClient(connectionManager);
        httpclient.setHostConfiguration(hostConfiguration);
    }
Based on http-client.jar library thread safe using httpclient connection pool
metamorphosis-http-client/src/main/java/com/taobao/metamorphosis/client/http/SimpleHttpClient.java