Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed web service unit tests behind a proxy in Eclipse

I have a problem executing unit tests in Eclipse behind a proxy, as the classes used by the unit tests call some web services, which are behind a proxy. In Tomcat I can of course specify a proxy to be used, but when I run unit tests directly from Eclipse, the proxy configuration of Eclipse seems to be ignored. How can I configure my unit tests or Eclipse to use a proxy in this case?

like image 645
simon Avatar asked Sep 30 '09 13:09

simon


1 Answers

I found the solution: apparently one can configure the proxy in run/debug settings in Eclipse. To do this:

  1. right click on the unit test class
  2. debug as - debug configurations
  3. go to tab "Arguments"
  4. add proxy configuration to "VM arguments":

    • -Dhttp.proxyHost=proxy.host.com
    • -Dhttp.proxyPort=8080
    • -Dhttp.nonProxyHosts=[list of hosts separated with pipe character]

If you are behind a password protected proxy, you have to add:

  • -Dhttp.proxyUser=someUserName
  • -Dhttp.proxyPassword=somePassword
like image 118
simon Avatar answered Sep 23 '22 10:09

simon