I'm on a corporate network trying to write a JSoup web scraper in Java, and I can't seem to connect.
To test things out, when I run the following code, it gives me a java.netConnectException: Connection refused.
Socket socket = null;
try {
socket = new Socket("google.com", 80)
System.out.println("it works!");
} finally {
if (socket != null) try { socket.close(); } catch(IOException e) {}
}
For the record, my JSoup code looks like this:
Connection con = Jsoup.connect("http://en.wikipedia.org/wiki/Main_Page");
Document doc = con.get();
When I run it alone, it gives me a TimeOut exception (even after alotting it a generous timeout). What should I do to get it to work within my network?