private static void buildHttpClient() {

        RequestConfig globalConfig =
                RequestConfig.custom().setConnectTimeout(5000)
                        .setSocketTimeout(5000).build();
        CloseableHttpClient httpclient =
                HttpClients.custom().setKeepAliveStrategy(new HttpClientKeepAliveStrategy())
                        .setDefaultRequestConfig(globalConfig).build();
        HttpClientUtil.httpclient = httpclient;
    }
private static void buildHttpClient ( ) { RequestConfig globalConfig = RequestConfig . custom ( ) . setConnectTimeout ( 5000 ) . setSocketTimeout ( 5000 ) . build ( ) ; CloseableHttpClient httpclient = HttpClients . custom ( ) . setKeepAliveStrategy ( new HttpClientKeepAliveStrategy ( ) ) . setDefaultRequestConfig ( globalConfig ) . build ( ) ; HttpClientUtil . httpclient = httpclient ; }
初始化httpclient对象