java opening urls with proxy taking very much time
Im working with java, specifically reading content from web pages, so the thing is that when I open a url using a proxy setting, it takes a lot of time in some cases (up to 15 or 20 secs) and sometimes the same url opens a lot faster (5 to 10 secs), this happens for some urls. If I dont use the proxy setting the urls open normally (2 to 5 secs).
Do you know why is this happenind and what can be done? Here is the开发者_如何转开发 part of the code
//set the proxy
System.setProperty("http.proxyHost", "web-proxy.xxx.xx.com");
System.setProperty("http.proxyPort", "xxxx");
//open url stream, this line is taking a lot of time with proxy...
BufferedReader is = new BufferedReader(new InputStreamReader(url
.openStream()));
Thanks
Make sure there is a good conection and transfer rate on the proxies. It all depends on what proxy you use (where it is located at).
精彩评论