HttpGet 设置请求超时时间

 

百度的时候看到一个博客讲的是这个,但是图片不能复制,我发一个。这个单位是毫秒。

HttpGet httpGet = new HttpGet(url);
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(500000).setConnectionRequestTimeout(100000).setSocketTimeout(500000).build();
httpGet.setConfig(requestConfig);

 

参考博客地址:https://www.cnblogs.com/lichmama/p/5715191.html

posted @ 2020-07-03 16:02  90的生力军  阅读(6597)  评论(0编辑  收藏  举报