hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Remijan <mjremi...@yahoo.com>
Subject Proxy Question
Date Tue, 21 Jun 2011 13:13:11 GMT
I have searched online for quite some time looking for information about httpclient connection
through a proxy.  Though I've found a lot of information I have not found a solution yet


I have the same problem lots of others have.  I'm using a library which uses httpclient however
I do not have access to that library's code.  Now need to be able to configure the proxy
for httpclient in my App.

I looks like DefaultHttpParams is the way to go.  I have this in my code...

            HttpParams params = DefaultHttpParams.getDefaultParams();
            params.setParameter("http.proxyHost",
 "SERVER_NAME");
            params.setParameter("http.proxyPort", "PORT");   

When I run my tests it fails with a timeout exception...

Caused by: java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(SocketInputStream.java:168)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
    at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:77)
    at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:105)
    at org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1115)
    at
 org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1832)
    at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1590)
    at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:995)
    at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
    at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)
    at org.ferris.net.runner.HttpRequestRunner.executeMethod(HttpRequestRunner.java:211)
    ... 25 more
Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 21.68
 sec


How can I configure the proxy correctly?  


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