wood burning stoves 2.0*
The moose likes Java in General and the fly likes problem accessing https through ssl connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Java in General
Bookmark "problem accessing https through ssl connection" Watch "problem accessing https through ssl connection" New topic

problem accessing https through ssl connection

Raj Shan
Ranch Hand

Joined: Sep 04, 2006
Posts: 65
Hi I tried the program. The HTTP is working fine but not https. I enquired our INFRA team. When I set the same proxy in my firewall client, I am able to hit both https and http but when I set the proxy in the code, I am able to hit only http and not https. Then the INFRA guy told me that the proxy that we set using http.proxyHost does not allow the traffic to go beyond the intranet. does this property (http.proxyHost) have any limitations? Can someone suggest how to get over this issue?

import java.net.URL;
import java.net.URLConnection;
import java.security.Security;
import org.apache.commons.codec.binary.Base64;
public class TestSSL {
public static void main(String[] args) {
System.getProperties().put( "proxySet","true" );
System.getProperties().put("http.proxyHost", "XXX");
System.getProperties().put("http.proxyPort", "XXX");

Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
try {

//System.getProperties().put("java.protocol.handler.pkgs", "HTTPClient");
//URL url = new URL("https://www.verisign.com/");

//URL url = new URL("https://apps.telstra.xora.com/xoraapps/services/XoraTimeTrackUtilityServices40?wsdl");
URL url = new URL("http://www.google.com");
//URL url = new URL("https://www.verisign.com");
URLConnection con = url.openConnection();

con.setDoInput( true );
con.setDoOutput( true );
java.io.InputStream urlfs = con.getInputStream();
System.out.println("Successful Connection Establishment =>"+url.getHost());

} catch (Exception e) {
System.out.println("Print Exception Details =>"+e.toString());

GeeCON Prague 2014
subject: problem accessing https through ssl connection