While working inside proxy testng returns connection timeout

Viewed 1409

When I'm connected to VPN/proxy Testng returns the following error when running tests in intellij:

org.testng.TestNGException: java.net.ConnectException: Connection timed out: connect
    at org.testng.TestNG.parseSuite(TestNG.java:354)
    at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:374)
    at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:39)
    at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:109)
Caused by: java.net.ConnectException: Connection timed out: connect
    at java.base/sun.nio.ch.Net.connect0(Native Method)
    at java.base/sun.nio.ch.Net.connect(Net.java:503)
    at java.base/sun.nio.ch.Net.connect(Net.java:492)
    at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:588)
    at java.base/java.net.Socket.connect(Socket.java:648)
    at java.base/java.net.Socket.connect(Socket.java:597)
    at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:182)
    at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:474)
    at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:569)
    at java.base/sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
    at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:341)
    at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:362)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1261)
    at 

Any ideas how could I set proxy for testng? Or a different solution?

1 Answers

To solve this, you have to specify VM parameters for test:

-Dhttp.proxyHost=your_host
-Dhttp.proxyPort=your_port
-Dhttps.proxyHost=your_host
-Dhttps.proxyPort=your_port
Related