• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem accessing https through ssl connection  RSS feed

Geetha Gubendran
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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());

It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!