T
tester
Hello, I am writing a java application to get a file from a HTTPS web
server.
The code is shown below. I have installed JSSE in advance (btw, is there
any
way to check whether the JSSE is installed successfully or not?). But I
got
ConnectException:Connection timed out error. Do u have any idea of the
reason?
import java.io.*;
import java.net.*;
import java.security.*;
public class TEST
{
public static void main (String args[]) throws Exception
{
System.getProperties().put("proxySet", "true");
System.getProperties().put("proxyHost", "PROXYSERVER");
System.getProperties().put("proxyPort", "8000");
System.setProperty("java.protocol.handler.pkgs",
"com.sun.net.ssl.internal.w
ww.protocol");
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
URL url = new URL("https://XXX.com/YYY.txt");
BufferedReader br = new BufferedReader(new
InputStreamReader(url.openStream()));
String line;
while ((line = br.readLine()) != null)
{
System.out.println(line);
}
br.close();
}
}
server.
The code is shown below. I have installed JSSE in advance (btw, is there
any
way to check whether the JSSE is installed successfully or not?). But I
got
ConnectException:Connection timed out error. Do u have any idea of the
reason?
import java.io.*;
import java.net.*;
import java.security.*;
public class TEST
{
public static void main (String args[]) throws Exception
{
System.getProperties().put("proxySet", "true");
System.getProperties().put("proxyHost", "PROXYSERVER");
System.getProperties().put("proxyPort", "8000");
System.setProperty("java.protocol.handler.pkgs",
"com.sun.net.ssl.internal.w
ww.protocol");
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
URL url = new URL("https://XXX.com/YYY.txt");
BufferedReader br = new BufferedReader(new
InputStreamReader(url.openStream()));
String line;
while ((line = br.readLine()) != null)
{
System.out.println(line);
}
br.close();
}
}