Https connection with HttpURLConnection with proxy
843790Dec 8 2006 — edited Dec 8 2006Hi,
I am trying this
String proxyHost = "";
String proxyPortStr = "";
String urlStr= "http://abc.com"
java.net.URL url = null;
if(proxyHost != null && proxyPort != -1 && proxyHost.length()>1 ){
String protocol = "http";
if(urlStr.startsWith("https")){
protocol = "https";
}
url = new URL(protocol,proxyHost,proxyPort,urlStr);
}else{
url = new URL(urlStr);
}
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
if(param != null){
connection.getOutputStream();
}
Now if i try to run this without proxy, it works. But with proxy it gives following message when i get the output stream
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
Please note that This issue comes only when i try to get output stream (mean i try to submit data)