sahaya / rest-assured

Automatically exported from code.google.com/p/rest-assured
0 stars 0 forks source link

Proxy configuration - doesn't seem to work #214

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I tried to configure sending requests via proxy but the response I get is as 
though proxy settings are not applied.

What steps will reproduce the problem?
1. Here is my code to send a request
HttpHost httpProxyInstance = new HttpHost("proxyhostname",80);
Response r = 
given().config(newConfig().httpClient(httpClientConfig().setParam(ConnRoutePName
s.DEFAULT_PROXY, httpProxyInstance))).expect()...

2. I turned on console logging for HTTP Client

What is the expected output? What do you see instead?
My testing url is such that it will return different responses depending on 
proxy. I get response as though no proxy is being used.
And there is no mention of proxy settings in HTTP Client log.

What version of the product are you using? On what operating system?
Rest-Assured 1.7.2, HTTP Client 4.2.3
Win 7x64

Please provide any additional information below.
HTTP Client itself seems to work:

HttpHost proxy = new HttpHost("proxyhostname", "proxy port", "http");
DefaultHttpClient httpclient = new DefaultHttpClient();
httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
HttpHost target = new HttpHost("url here", 80, "http");
HttpRequest req = new HttpGet("/");
HttpResponse rsp = httpclient.execute(target, req);

Response from this code is the one I need - and I see connecting to proxy in 
the log.

Original issue reported on code.google.com by ir.tim....@gmail.com on 23 Jan 2013 at 4:45

GoogleCodeExporter commented 9 years ago
Any suggestions on how I can test/reproduce this?

Original comment by johan.ha...@gmail.com on 17 Mar 2013 at 8:49

GoogleCodeExporter commented 9 years ago
See here about reproducing with proxy... 
https://groups.google.com/d/msg/rest-assured/1nNvMooPjpI/zH7gDoBsIVQJ 

Original comment by ir.tim....@gmail.com on 27 Mar 2013 at 9:24

GoogleCodeExporter commented 9 years ago
thanks

Original comment by johan.ha...@gmail.com on 27 Mar 2013 at 9:49

GoogleCodeExporter commented 9 years ago
For what it's worth, adding -Dhttp.proxyHost and -Dhttp.proxyPort system 
properties does seem to work.

Original comment by normanwalsh on 27 Mar 2014 at 4:28

GoogleCodeExporter commented 9 years ago
Interesting, thanks for sharing.

Original comment by johan.ha...@gmail.com on 27 Mar 2014 at 6:31

GoogleCodeExporter commented 9 years ago
This worked for me.

static {
    System.setProperty("https.proxyHost", "yourProxyHost");
    System.setProperty("https.proxyPort", "yourProxyPort");
}

Original comment by vasy...@gmail.com on 21 Apr 2014 at 3:09

GoogleCodeExporter commented 9 years ago

Original comment by johan.ha...@gmail.com on 5 Jun 2014 at 11:22

GoogleCodeExporter commented 9 years ago
I've implemented better proxy support now, for example:

given().proxy("127.0.0.1", 8888). ..

or statically:

RestAssured.proxy("127.0.0.1", 8888);

Please try it out by depending on version 2.3.2-SNAPSHOT after having added the 
following maven repo:
<repositories>
        <repository>
            <id>sonatype</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
            <snapshots />
        </repository>
</repositories>

I'd like to release a new version asap so please give me feedback.

Original comment by johan.ha...@gmail.com on 5 Jun 2014 at 11:51

GoogleCodeExporter commented 9 years ago
Regarding this as fixed since I got reply.

Original comment by johan.ha...@gmail.com on 7 Jun 2014 at 3:28