Umer Hayat Umer Hayat - 1 year ago 121
Java Question

UnknownHostException while accessing HTTPS url using jsoup

I am trying to parse and manipulate HTML using jsoup. It is working perfectly fine for HTTP URLs but it's throwing

if a HTTPS URL is used. Following is my code:

System.setProperty("http.proxyHost", "");
System.setProperty("http.proxyPort", "8080");

Document doc = Jsoup.connect("").get();

I was rather expecting an exception related to SSL certificates but what could be the reason for
? Please note that the following code runs perfectly for

Answer Source

Check here, you need to specify the proxy for https in a seperate way.

System.setProperty("https.proxyHost", "your host");
System.setProperty("https.proxyPort", "your port");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download