/* *
* set the global agent
* @ param ipBean
*/
Public static void setGlobalProxy (IPBean IPBean) {
System. SetProperty (" proxyPort ", String. The valueOf (ipBean. The getPort ()));
System. SetProperty (" proxyHost, "ipBean getIp ());
System. SetProperty (" proxySet ", "true");
}
The above is my set global agents, but the native IP or been closed, in addition, use the
HttpHost proxy=new HttpHost (" 111.222.141.127 ", 8118);
CloseableHttpClient httpclient=HttpClients. Custom ()
. SetConnectionManager (connManager)
. SetProxy (proxy)
The build ();
System. The out. Println (" proxy ");
Connection timeout problems frequently, changes the attributes or not, only set the global agent this works better