看起来我可以在构造新的HttpClient
时指定代理:
HttpHost proxy = new HttpHost("someproxy", 8080);
DefaultProxyRoutePlanner routePlanner = new DefaultProxyRoutePlanner(proxy);
CloseableHttpClient httpclient = HttpClients.custom()
.setRoutePlanner(routePlanner)
.build();
能否修改现有客户端的代理设置。
取自http://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html#d5e475