hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sadashiv Patwary" <SPatw...@axeda.com>
Subject Problem with Httptunneling using ProxyClient
Date Tue, 15 Jul 2008 20:45:36 GMT
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


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message