Using restassured to call API behind proxy

In most of the organisations we have proxies and while using restassured we face “java.net.ConnectException: Connection timed out” or “java.net.ConnectException: Connection refused” error as proxy does not allows the traffic. To resolve same we need to set the proxy settings before making the call. To do the same there are two methods – either use System.setProperty or use io.restassured.specification . While using System.setProprty again there are two ways. One is just use system proxy System.setProperty (“java.net.useSystemProxies”, “true”); Or set all properties manually as below // The hostname, or address, of the proxy server used by the HTTP protocol handler. System.setProperty(“http.proxyHost”, “myproxy.domain.com”); // The port number of the proxy server used by the HTTP protocol handler. System.setProperty(“http.proxyPort”, “8080”); // The hostname, or address, of the proxy server used by the HTTPS protocol handler. System.setProperty(“https.proxyHost”, “myproxy.domain.com”); // The port number of the proxy server used by the HTTPS protocol handler. System.setProperty(“https.proxyPort”, “443”);… Read more“Using restassured to call API behind proxy”