Hello,
I have a problem opening connections to https-webservers on my Linux server. I am using the mini-program below to hunt down the problem.
Essentially, the program hangs forever (waited several minutes) when trying to open any https-URL. Normal http-URLs work as they should.
The odd thing is, this program just doesn't seem to work on one particular Debian Linux server, even when connecting to SSL Servers in the same network segment. On a local Windows machine, or on other Linuxes, this works without a problem.
There is JDK 1.4.2_10 installed there, but this didn't work with an earlier build, I think 1.4.2_06 had the same problem already. That was the reason why I did this update...
Can anybody help, or does anyone have the same problem? Do SSL certificates somewhere get cached or something like that, so that some file might be broken I'm currently not thinking of?
All help is much appreciated.
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
public class SSLTest {
public static void main(String[] args) {
try {
String urlString = "https://www.web.de";
if (args.length >= 1) {
urlString = args[0];
}
URL url = new URL(urlString);
System.out.println("Getting connection to " + urlString);
// hangs forever with https-URLs
URLConnection conn = url.openConnection();
System.out.println("Opening " + conn.toString());
InputStream in = conn.getInputStream();
BufferedReader d = new BufferedReader(new InputStreamReader(in));
String s = null;
while ((s = d.readLine()) != null) {
System.out.println(s);
}
}
catch (Exception ex) {
System.err.println(ex.getMessage());
ex.printStackTrace();
}
}
}