Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Https connection with HttpURLConnection with proxy

843790Dec 8 2006 — edited Dec 8 2006
Hi,
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)

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jan 5 2007
Added on Dec 8 2006
1 comment
276 views