summaryrefslogtreecommitdiff
path: root/main/src/test/java/de/blinkt/openvpn
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2018-03-14 23:03:34 +0100
committerArne Schwabe <arne@rfc2549.org>2018-03-14 23:03:34 +0100
commit111c3cf994f6788aa6251f3f8a1992765ba967d1 (patch)
tree01edd4d62ae24e085366c8ad34ef49bbd8d2d35b /main/src/test/java/de/blinkt/openvpn
parenta8a48a9a67a94a3ddb547dc481ccf375f15e1e25 (diff)
Tests for sock proxy support
Diffstat (limited to 'main/src/test/java/de/blinkt/openvpn')
-rw-r--r--main/src/test/java/de/blinkt/openvpn/core/TestConfigParser.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/main/src/test/java/de/blinkt/openvpn/core/TestConfigParser.java b/main/src/test/java/de/blinkt/openvpn/core/TestConfigParser.java
index 560d4fc8..5793676f 100644
--- a/main/src/test/java/de/blinkt/openvpn/core/TestConfigParser.java
+++ b/main/src/test/java/de/blinkt/openvpn/core/TestConfigParser.java
@@ -34,4 +34,42 @@ public class TestConfigParser {
Assert.assertTrue(p.mCustomConfigOptions.contains(httpproxypass));
}
+
+ @Test
+ public void testSockProxyImport() throws IOException, ConfigParser.ConfigParseError {
+ String proxy =
+ "<connection>\n" +
+ "socks-proxy 13.23.3.2\n" +
+ "remote foo.bar\n" +
+ "</connection>\n" +
+ "\n" +
+ "<connection>\n" +
+ "socks-proxy 1.2.3.4 1234\n" +
+ "remote foo.bar\n" +
+ "</connection>\n" +
+ "\n" +
+ "<connection>\n" +
+ "http-proxy 1.2.3.7 8080\n" +
+ "remote foo.bar\n" +
+ "</connection>";
+
+ ConfigParser cp = new ConfigParser();
+ cp.parseConfig(new StringReader(proxy));
+ VpnProfile vp = cp.convertProfile();
+ Assert.assertEquals(3, vp.mConnections.length);
+
+ Assert.assertEquals("13.23.3.2", vp.mConnections[0].mProxyName);
+ Assert.assertEquals("1080", vp.mConnections[0].mProxyPort);
+ Assert.assertEquals(Connection.ProxyType.SOCKS5, vp.mConnections[0].mProxyType);
+
+ Assert.assertEquals("1.2.3.4", vp.mConnections[1].mProxyName);
+ Assert.assertEquals("1234", vp.mConnections[1].mProxyPort);
+ Assert.assertEquals(Connection.ProxyType.SOCKS5, vp.mConnections[0].mProxyType);
+
+ Assert.assertEquals("1.2.3.7", vp.mConnections[2].mProxyName);
+ Assert.assertEquals("8080", vp.mConnections[2].mProxyPort);
+ Assert.assertEquals(Connection.ProxyType.HTTP, vp.mConnections[2].mProxyType);
+ }
+
+
}