set timeout
wilson meier <[email protected]> Wed, 22 Jul 2009 20:35:27 +0200
| Newsgroups | gmane.comp.web.httpunit.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi all,
i try to receive a website with different proxies.
I'd like to set an timeout to sort out slow proxies.
I tried following code but no luck.
Any help on that?
public static String getUrl(String pUrl, ProxyUnit pUnit, int pTimeout)
{
String body = null;
try
{
WebConversation wc = new WebConversation();
wc.setProxyServer(pUnit.getIp(), pUnit.getPort());
wc.set_connectTimeout(pTimeout);
wc.set_readTimeout(pTimeout);
HttpUnitOptions.setScriptingEnabled(false);
WebRequest req = new GetMethodWebRequest(pUrl);
WebResponse resp = wc.getResponse(req);
body = resp.getText();
}
catch (Exception ex)
{
if (_logger.isDebugEnabled())
{
_logger.error(ex.getMessage());
}
}
return body;
}
------------------------------------------------------------------------------
_______________________________________________
Httpunit-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/httpunit-develop