proxyTest.java: unset proxy/socks before testing it

This commit is contained in:
Random Committer 2018-04-20 09:53:49 -07:00
parent 95d1e0a120
commit 34699bf8c6

View File

@ -9,8 +9,14 @@ import com.rarchives.ripme.utils.Http;
public class proxyTest extends TestCase { public class proxyTest extends TestCase {
// This test will only run on machines where the user has added a entry for proxy.socks // This test will only run on machines where the user has added a entry for proxy.socks
public void testSocksProxy() throws IOException { public void testSocksProxy() throws IOException {
// Unset proxy before testing
System.setProperty("http.proxyHost", "");
System.setProperty("https.proxyHost", "");
System.setProperty("socksProxyHost", "");
URL url = new URL("https://icanhazip.com"); URL url = new URL("https://icanhazip.com");
String proxyConfig = Utils.getConfigString("proxy.socks", ""); String proxyConfig = Utils.getConfigString("proxy.socks", "");
if (!proxyConfig.equals("")) { if (!proxyConfig.equals("")) {
@ -26,6 +32,10 @@ public class proxyTest extends TestCase {
// This test will only run on machines where the user has added a entry for proxy.http // This test will only run on machines where the user has added a entry for proxy.http
public void testHTTPProxy() throws IOException { public void testHTTPProxy() throws IOException {
// Unset proxy before testing
System.setProperty("http.proxyHost", "");
System.setProperty("https.proxyHost", "");
System.setProperty("socksProxyHost", "");
URL url = new URL("https://icanhazip.com"); URL url = new URL("https://icanhazip.com");
String proxyConfig = Utils.getConfigString("proxy.http", ""); String proxyConfig = Utils.getConfigString("proxy.http", "");
if (!proxyConfig.equals("")) { if (!proxyConfig.equals("")) {