Menu

#82 proxy connection fail

General
closed-rejected
nobody
None
5
2015-04-18
2015-04-16
Alex
No

Hi!
I am using jericho 3.2 and I have a problem. I have to use a proxy connection to access a web. I have a list of proxy in txt file, some proxies may be available or not. To demonstrate proper operation I have this little code:
System.setProperty("http.proxyHost", proxy_ip);
System.setProperty("http.proxyPort", proxy_port);
try
{
Source source = new Source(new URL("www.google.com"));
System.out.println("Proxy OK");
}
catch (IOException ex)
{
System.out.println("Proxy fail");
}

This code work but sometimes falls off the proxy or something and stays locked application and I can not do anything.

Is there any solution for this?
Is there any way that if you spend much time ~ 10s skip an exception?

Thanks!!
Regards!
Alex

Discussion

  • Martin Jericho

    Martin Jericho - 2015-04-18

    Hi Alex,
    I'd suggest you use your own code to manage connections and load the content, then use the CharSequence or Reader constructor argument for the Source objct.
    I'd also suggest you upgrade to 3.3, or better yet the development version 3.4-dev:
    http://jericho.htmlparser.net/temp/jericho-html-3.4-dev.zip
    Martin

     
  • Martin Jericho

    Martin Jericho - 2015-04-18
    • status: unread --> closed-rejected
     

Log in to post a comment.