Hi, I'm a bit new to Java and HTMLUnit. I'm trying to use proxies in my program but if one proxy is dead program is shouting down(getting error smtg like timeout or 504 DNS Name Not Found for http:..). How can I force it to continue working?
Code:
try{ // Open the file that is the first
// command line parameter
FileInputStream fstream = new FileInputStream("textfile.txt");
// Get the object of DataInputStream
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
//Read File Line By Line
while ((strLine = br.readLine()) != null) {
ProxyConfig pc=new ProxyConfig();
pc.setProxyHost(strLine);
pc.setProxyPort(3128);
webClient.setProxyConfig(pc);
System.out.println(strLine);
HtmlPage currentPage = webClient.getPage("site");
//
// webClient.waitForBackgroundJavaScript(30000);
//System.out.println(currentPage.asText());
//System.out.println (strLine);
}
//Close the input stream
in.close();
}catch (Exception e){//Catch exception if any
System.err.println("Error: " + e.getMessage());
}