dev@glassfish.java.net

Unable to tunnel through proxy for HTTPS

From: Deepa Singh <Deepa.Singh_at_Sun.COM>
Date: Thu, 18 May 2006 11:16:58 -0700

Hi All,
I had a non appserver related question

I am trying to access a HTTPS URL from my client socket . This URL is
external to Sun, on regular internet, I am able to lookup from browser
fine, but when I open a URLConnection to it,I get following exception,
I set proxy as follows:

System.setProperty("https.proxyHost", proxyHost);
System.setProperty("https.proxyPort", proxyPort);
URL url = new URL(secureURL);
URLConnection conn = url.openConnection();

java.io.IOException: Unable to tunnel through proxy. Proxy returns
"HTTP/1.1 400 Bad request"
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
        at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at
sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1202)
        at java.security.AccessController.doPrivileged(Native Method)
        at
sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1196)
        at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:885)
        at
sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234)
        at
com.sun.glassfish.bugbridge.issuetracker.IssueTrackerClient.doPOST(Unknown
Source)
        at
com.sun.glassfish.bugbridge.issuetracker.IssueTrackerClient.main(Unknown
Source)
Caused by: java.io.IOException: Unable to tunnel through proxy. Proxy
returns "HTTP/1.1 400 Bad request"
        at
sun.net.www.protocol.http.HttpURLConnection.doTunneling(HttpURLConnection.java:1324)
        at
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:168)
        at
sun.net.www.protocol.http.HttpURLConnection.followRedirect(HttpURLConnection.java:1698)
        at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1085)
        at
sun.net.www.protocol.http.HttpURLConnection.getHeaderFieldKey(HttpURLConnection.java:1919)
        at
sun.net.www.protocol.https.HttpsURLConnectionImpl.getHeaderFieldKey(HttpsURLConnectionImpl.java:287)
        ... 2 more