commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joao Cerdeira <joao.cerde...@multicert.com>
Subject [HTTPClient] Problems with SSL and PROXY
Date Tue, 17 Feb 2004 13:22:58 GMT
Hi,

I have a class using the last version of httpclient the build 2.0

and i need to make a HTTPS request throuth a proxy.

*My CODE:*

Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
        System.setProperty("java.protocol.handler.pkgs", 
"com.sun.net.ssl.internal.www.protocol");
       
        Protocol myhttps = new Protocol("https", new 
SSLProtocolSocketFactory(), 443);

        HttpConnection hc = new HttpConnection("www.multicert.com",443, 
myhttps);
        hc.setProxyHost("proxy.multicert.inet");
        hc.setProxyPort(8080);
       
       
        try
        {
           
           
            hc.open();
            hc.tunnelCreated();
           
            GetMethod post = new GetMethod("/");
           

           
            System.out.println("code -> " + post.execute(new 
HttpState(),hc));
            System.out.println("data -> " + new 
String(post.getResponseBodyAsString()));
           
        } catch (Exception e)
        {
            e.printStackTrace();
        }

*MY STACK TRACE:*

run-client:
     [java] java.net.SocketException: Socket closed
     [java]     at 
com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
     [java]     at 
com.sun.net.ssl.internal.ssl.AppOutputStream.write([DashoPro-V1.2-120198])
     [java]     at 
org.apache.commons.httpclient.HttpConnection$WrappedOutputStream.write(HttpConnection.java:1368)
     [java]     at 
java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:67)
     [java]     at 
java.io.BufferedOutputStream.flush(BufferedOutputStream.java:125)
     [java]     at 
org.apache.commons.httpclient.HttpConnection.flushRequestOutputStream(HttpConnection.java:799)
     [java]     at 
org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2277)
     [java]     at 
org.apache.commons.httpclient.HttpMethodBase.processRequest(HttpMethodBase.java:2657)
     [java]     at 
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1093)
     [java]     at TesteJakarta.main(TesteJakarta.java:43)


give me this error.

Anyone give me a help please.

NOTE: My proxys supports SSL Tunneling.

Thanks,
    João Cerdeira


-- 

João António Figueira Cerdeira <mailto:joao.cerdeira@multicert.com>

	

joao.cerdeira@multicert.com

Investigação, Desenvolvimento e Consultadoria
	Gestor de E-Bussiness

MULTICERT S.A.

	

http://www.multicert.com/

Edifício Correios de Portugal - Praça da Trindade, 32, 3º Andar

	

4000-539 Porto - Portugal 

	

Tel: +351 223 391 810

	

Fax: +351 223 391 811  
      




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message