Debugging java.net.ConnectException: Connection refused: Error
843833Apr 29 2002 — edited Jun 10 2002Hello All,
I am using JSSE 1.0.2 with the following java code to retrieve an html from and https site. However, I get java.net.ConnectException: Connection refused:. I tried to use Djavax.net.debug=all to see what is worng, but it does not show why connection was refused.
Here is my java code:
import java.util.*;
import java.net.*;
import java.io.*;
import java.security.*;
import javax.net.ssl.*;
public class getHTTPS{
public static void main(String[] args){
String out = new String();
System.setProperty("java.protocol.handler.pkgs",
"com.sun.net.ssl.internal.www.protocol");
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
try{
out = pullURL("https://www.verisign.com");
}
catch(Exception e){
System.out.println(e);
}
System.out.println(out);
}
public static String pullURL(String urlname)throws Exception{
Properties properties = System.getProperties();
properties.put("https.proxyHost", "my.proxy.com");
properties.put("https.proxyPort", "80");
URL u = new URL(urlname);
BufferedReader br =
new BufferedReader( new InputStreamReader(u.openStream()));
String line;
return ("Success");
}
}
And here whay I get with Djavax.net.debug=all
keyStore is :
keyStore type is : jks
init keystore
init keymanager of type SunX509
trustStore is: D:\jdk1.3.1_02\jre\lib\security\cacerts
trustStore type is : jks
init truststore
...
init context
trigger seeding of SecureRandom
done seeding SecureRandom
java.net.ConnectException: Connection refused: connect
How can I get more details about the cause of this error?
All inputs are highly appreciated.
Thanks.
Tarek