I'm trying to get Jsoup to connect to reddit and get its title via a proxy server using this code:
package js;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
public class Test {
public static void main(String[] args) throws Exception {
System.setProperty("http.proxyHost", "123.456.789.2342.");
System.setProperty("http.proxyPort", "5846123232");
Document doc = Jsoup.connect("http://reddit.com/").get();
String title = doc.title();
System.out.println(title);
}
}
Despite the proxy data obviously being wrong, this code still works and prints
reddit: the front page of the internet
so it didn't seem to use or try to use that proxy server at all. How do I get Jsoup to use a given proxy server?