CloseableHttpClient read time out

public static String httpGetRequest(String url) {
   HttpGet httpGet = new HttpGet(url);
  //加入超时设置
   RequestConfig requestConfig  = RequestConfig.custom()
         .setSocketTimeout(5000)
         .setConnectTimeout(5000)
         .setConnectionRequestTimeout(5000)
         .setStaleConnectionCheckEnabled(true)
         .build();
   httpGet.setConfig(requestConfig);
}
阅读更多
文章标签: httpclient超时
个人分类: web java
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭