hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: ConnectException: HttpClient proxy settings
Date Thu, 02 Apr 2009 18:17:07 GMT
Villemos, Gert wrote:
> I have problems accessing a site through a proxy.
> 
>  
> 
> I'm connecting to a site demanding credentials (https on default port
> 443) through a local proxy (port 80) with authentication. I have read
> the documentation and it looked simple, I just cant get it to work. My
> source code is shown below;
> 
>  
> 
>  
> 
> HttpClient client = new HttpCLient();
> 
>  
> 
> if (proxyEnabled == true) {
> 
> Logger.info("Local proxy enabled.  Proxy URL " + proxyUrl + ", proxyPort
> " + proxyPort + ", proxyUser " + proxyUserName + ", proxyUserPassword "
> + proxyUserPassword);
> 
> client.getHostConfiguration().setProxy(proxyUrl, proxyPort);
> 
> client.getState().setProxyCredentials(
> 
>             new AuthScope(proxyUrl, proxyPort, AuthScope.ANY_REALM), 
> 
>             new UsernamePasswordCredentials(proxyUserName,
> proxyUserPassword)
> 
>       );    
> 
> }
> 
>  
> 
> client.getState().setCredentials(   
> 
>       new AuthScope(elogUrl, elogPort, AuthScope.ANY_REALM),
> 
>       new UsernamePasswordCredentials(userName, userPassword)
> 
> );
> 
>  
> 
>  
> 
>  
> 
> When I try to access from a place without proxy (... home in my comfy
> chair) this succeeds, i.e. the credentials works. When I try this
> through my companies proxy, I get the exception;
> 
>  
> 
>  
> 
>  
> 
> [Apr 02 17:46:17] INFO  (HttpMethodDirector.java:439) - I/O exception
> (java.net.ConnectException) caught when processing request: Connection
> timed out: connect
> 
> [Apr 02 17:46:17] INFO  (HttpMethodDirector.java:445) - Retrying request
> 
> [Apr 02 17:46:38] INFO  (HttpMethodDirector.java:439) - I/O exception
> (java.net.ConnectException) caught when processing request: Connection
> timed out: connect
> 
> [Apr 02 17:46:38] INFO  (HttpMethodDirector.java:445) - Retrying request
> 
> [Apr 02 17:46:59] INFO  (HttpMethodDirector.java:439) - I/O exception
> (java.net.ConnectException) caught when processing request: Connection
> timed out: connect
> 
> [Apr 02 17:46:59] INFO  (HttpMethodDirector.java:445) - Retrying request
> 
> java.net.ConnectException: Connection timed out: connect
> 
>       at java.net.PlainSocketImpl.socketConnect(Native Method)
> 
>       at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
> 
>       at
> java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
> 
>       at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
> 
>       at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
> 
>       at java.net.Socket.connect(Socket.java:520)
> 
>       at
> com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:54
> 5)
> 
>       at
> com.sun.net.ssl.internal.ssl.SSLSocketImpl.<init>(SSLSocketImpl.java:389
> )
> 
>       at
> com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket(SSLSocket
> FactoryImpl.java:121)
> 
>       at
> org.esa.eeis.elogwebcrawler.EasySSLProtocolSocketFactory.createSocket(Ea
> sySSLProtocolSocketFactory.java:155)
> 
>       at
> org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:70
> 7)
> 
>       at
> org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMe
> thodDirector.java:387)
> 
>       at
> org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMetho
> dDirector.java:171)
> 
>       at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:3
> 97)
> 
>       at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:3
> 46)
> 
>  
> 
>  
> 
>  
> 
> I have tried using URL as well as IP of the proxy, but get the same
> fault. I'm sure I use the correct use and password.
> 
>  
> 
> What am I doing wrong?
> 
>  

AuthScope are all wrong. Use hostnames instead of URLs

Oleg


> 
> Thanks,
> 
> Gert.
> 
> 
> 
> Please help Logica to respect the environment by not printing this email  /  Merci d'aider
Logica à préserver l'environnement en évitant d'imprimer ce mail /  Bitte drucken Sie diese
Nachricht nicht aus und helfen Sie so Logica dabei die Umwelt zu schuetzen  /  Por favor ajude
a Logica a respeitar o ambiente não imprimindo este correio electrónico.
> 
> 
> 
> This e-mail and any attachment is for authorised use by the intended recipient(s) only.
It may contain proprietary material, confidential information and/or be subject to legal privilege.
It should not be copied, disclosed to, retained or used by, any other party. If you are not
an intended recipient then please promptly delete this e-mail and any attachment and all copies
and inform the sender. Thank you.
> 
> 


---------------------------------------------------------------------
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