hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sadashiv Patwary" <SPatw...@axeda.com>
Subject RE: Problem with Httptunneling using ProxyClient
Date Wed, 16 Jul 2008 13:24:50 GMT

Please ignore the mail I figured it out I was using wrong port .
-----Original Message-----
From: Sadashiv Patwary [mailto:SPatwary@axeda.com] 
Sent: Tuesday, July 15, 2008 4:46 PM
To: HttpClient User Discussion
Subject: Problem with Httptunneling using ProxyClient

Hi all,

      I am having issues with httptunneling using proxyclient. I am
using ISA proxy server I am getting below error which is the else block
of the code.I am doing a http connect to www.yahoo.com
<http://www.yahoo.com/>  and once I get the socket I want to use the
socket.

 

Connect failed: HTTP/1.1 502 Proxy Error ( The specified Secure Sockets
Layer (SSL) port is not allowed. ISA Server is not configured to allow
SSL requests from this port. Most Web browsers use port 443 for SSL
requests.  )

 

Any hint where I am going wrong!!!

 

Below is the code snapshot:

 

 

 

ProxyClient proxyclient = new ProxyClient();

        // set the host the proxy should create a connection to

        //

        // Note:  By default port 80 will be used. Some proxies only
allow conections

        // to ports 443 and 8443.  This is because the HTTP CONNECT
method was intented

        // to be used for tunneling HTTPS.

        proxyclient.getHostConfiguration().setHost("www.yahoo.com");

      logger.info("set the host ");

        // set the proxy host and port

        proxyclient.getHostConfiguration().setProxy("proxyip",proxyport
);

        // set the proxy credentials, only necessary for authenticating
proxies

        proxyclient.getState().setProxyCredentials(

            new AuthScope("proxyip",proxyport, null),

            new UsernamePasswordCredentials("proxy", "proxy"));

 

        // create the socket

        ProxyClient.ConnectResponse response = proxyclient.connect();

 

       logger.info("after the response is  ");

 

      if (response.getSocket() != null) {

        logger.info("if (response.getSocket() != null) {  ");

           Socket socket = response.getSocket();

           sslSocket = (SSLSocket) sf.createSocket(socket,

                                              host, port, true);

       }

        else {

            // the proxy connect was not successful, check connect
method for reasons why

            System.out.println("Connect failed: " +
response.getConnectMethod().getStatusLine());

 
System.out.println(response.getConnectMethod().getResponseBodyAsString()
);

        }

 

Regards

shiva


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message