summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorSimon Rettberg2017-08-01 15:45:48 +0200
committerSimon Rettberg2017-08-01 15:45:48 +0200
commitdf53b12c42252be8ffe9aa1eb1a9adf3002f1545 (patch)
treef4121df496411a251edaaaa8c9550b46abc00f56 /src/test
parentMinor tweaks (diff)
downloadproxy-vole-df53b12c42252be8ffe9aa1eb1a9adf3002f1545.tar.gz
proxy-vole-df53b12c42252be8ffe9aa1eb1a9adf3002f1545.tar.xz
proxy-vole-df53b12c42252be8ffe9aa1eb1a9adf3002f1545.zip
Make proxy type detection more intelligent, decouple from target protocol
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/com/btr/proxy/selector/fixed/FixedProxyTest.java4
-rw-r--r--src/test/java/com/btr/proxy/util/ProxyUtilTest.java16
2 files changed, 10 insertions, 10 deletions
diff --git a/src/test/java/com/btr/proxy/selector/fixed/FixedProxyTest.java b/src/test/java/com/btr/proxy/selector/fixed/FixedProxyTest.java
index c4a7d08..017f669 100644
--- a/src/test/java/com/btr/proxy/selector/fixed/FixedProxyTest.java
+++ b/src/test/java/com/btr/proxy/selector/fixed/FixedProxyTest.java
@@ -1,6 +1,6 @@
package com.btr.proxy.selector.fixed;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
import java.net.Proxy;
import java.net.ProxySelector;
@@ -23,7 +23,7 @@ public class FixedProxyTest {
************************************************************************/
@Test
public void testFixedProxy() {
- ProxySelector ps = new FixedProxySelector("http_proxy.unit-test.invalid", 8090);
+ ProxySelector ps = new FixedProxySelector(Proxy.Type.HTTP, "http_proxy.unit-test.invalid", 8090);
List<Proxy> result = ps.select(TestUtil.HTTP_TEST_URI);
assertEquals(TestUtil.HTTP_TEST_PROXY, result.get(0));
diff --git a/src/test/java/com/btr/proxy/util/ProxyUtilTest.java b/src/test/java/com/btr/proxy/util/ProxyUtilTest.java
index d8e10c5..5634600 100644
--- a/src/test/java/com/btr/proxy/util/ProxyUtilTest.java
+++ b/src/test/java/com/btr/proxy/util/ProxyUtilTest.java
@@ -1,14 +1,14 @@
package com.btr.proxy.util;
-import static junit.framework.Assert.*;
+import static junit.framework.Assert.assertEquals;
import java.net.Proxy;
+import java.net.ProxySelector;
import java.util.List;
import org.junit.Test;
import com.btr.proxy.TestUtil;
-import com.btr.proxy.selector.fixed.FixedProxySelector;
/*****************************************************************************
@@ -24,7 +24,7 @@ public class ProxyUtilTest {
@Test
public void testParseProxySettings() {
- FixedProxySelector rs = ProxyUtil.parseProxySettings("http://http_proxy.unit-test.invalid/");
+ ProxySelector rs = ProxyUtil.parseProxySettings("http://http_proxy.unit-test.invalid/");
List<Proxy> psList = rs.select(TestUtil.HTTP_TEST_URI);
assertEquals("HTTP @ http_proxy.unit-test.invalid:80", psList.get(0).toString());
}
@@ -35,9 +35,9 @@ public class ProxyUtilTest {
@Test
public void testParseProxySettings2() {
- FixedProxySelector rs = ProxyUtil.parseProxySettings("http://http_proxy.unit-test.invalid:8080/");
+ ProxySelector rs = ProxyUtil.parseProxySettings("socks://http_proxy.unit-test.invalid:8080/");
List<Proxy> psList = rs.select(TestUtil.HTTP_TEST_URI);
- assertEquals("HTTP @ http_proxy.unit-test.invalid:8080", psList.get(0).toString());
+ assertEquals("SOCKS @ http_proxy.unit-test.invalid:8080", psList.get(0).toString());
}
/*************************************************************************
@@ -46,7 +46,7 @@ public class ProxyUtilTest {
@Test
public void testParseProxySettings3() {
- FixedProxySelector rs = ProxyUtil.parseProxySettings("http_proxy.unit-test.invalid");
+ ProxySelector rs = ProxyUtil.parseProxySettings("http_proxy.unit-test.invalid");
List<Proxy> psList = rs.select(TestUtil.HTTP_TEST_URI);
assertEquals("HTTP @ http_proxy.unit-test.invalid:80", psList.get(0).toString());
}
@@ -57,7 +57,7 @@ public class ProxyUtilTest {
@Test
public void testParseProxySettings4() {
- FixedProxySelector rs = ProxyUtil.parseProxySettings("http_proxy.unit-test.invalid:8080");
+ ProxySelector rs = ProxyUtil.parseProxySettings("http_proxy.unit-test.invalid:8080");
List<Proxy> psList = rs.select(TestUtil.HTTP_TEST_URI);
assertEquals("HTTP @ http_proxy.unit-test.invalid:8080", psList.get(0).toString());
}
@@ -68,7 +68,7 @@ public class ProxyUtilTest {
@Test
public void testParseProxySettings5() {
- FixedProxySelector rs = ProxyUtil.parseProxySettings("192.123.123.1:8080");
+ ProxySelector rs = ProxyUtil.parseProxySettings("192.123.123.1:8080");
List<Proxy> psList = rs.select(TestUtil.HTTP_TEST_URI);
assertEquals("HTTP @ 192.123.123.1:8080", psList.get(0).toString());
}