/hg/icedtea-web: Unit tests for JNLPProxySelector

omajid at icedtea.classpath.org omajid at icedtea.classpath.org
Mon Sep 23 09:36:17 PDT 2013


changeset bd8e09edc806 in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=bd8e09edc806
author: Omair Majid <omajid at redhat.com>
date: Mon Sep 23 12:34:25 2013 -0400

	Unit tests for JNLPProxySelector

	This contains one functional change:
	- String host = uri.getSchemeSpecificPart().split(":")[0];
	+ String host = uri.getHost();

	Given the URI of "socket://example.org", the first line
	evaluates to "//example.org", while the second one (correctly)
	evaluates to "example.org".


diffstat:

 ChangeLog                                                               |   23 +
 netx/net/sourceforge/jnlp/browser/BrowserAwareProxySelector.java        |    5 +-
 netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java           |    4 +-
 netx/net/sourceforge/jnlp/runtime/JNLPProxySelector.java                |   16 +-
 netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java                      |    2 +-
 plugin/icedteanp/java/sun/applet/PluginMain.java                        |    2 +-
 plugin/icedteanp/java/sun/applet/PluginProxySelector.java               |    5 +
 tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPProxySelectorTest.java |  321 ++++++++++
 8 files changed, 363 insertions(+), 15 deletions(-)

diffs (490 lines):

diff -r a5e65b8ac54c -r bd8e09edc806 ChangeLog
--- a/ChangeLog	Fri Sep 20 11:41:36 2013 -0400
+++ b/ChangeLog	Mon Sep 23 12:34:25 2013 -0400
@@ -1,3 +1,26 @@
+2013-09-23  Omair Majid  <omajid at rehdat.com>
+
+	* netx/net/sourceforge/jnlp/browser/BrowserAwareProxySelector.java
+	(BrowserAwareProxySelector): Rename to...
+	(BrowserAwareProxySelector(DeploymentConfiguration)): New method.
+	* netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java: Clarify
+	possible values for KEY_PROXY_TYPE.
+	* netx/net/sourceforge/jnlp/runtime/JNLPProxySelector.java
+	(JNLPProxySelector): Rename to...
+	(JNLPProxySelector(DeploymentConfiguration)): New method.
+	(parseConfiguration): Rename to...
+	(parseConfiguration(DeploymentConfiguration)): New method.
+	(inBypassList): Get host from URI instead of manual hacks.
+	(getProxiesFromPacResult): Clarify return value.
+	* netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java
+	(initialize): Adjust for new BrowserAwareProxySelector constructor.
+	* plugin/icedteanp/java/sun/applet/PluginMain.java
+	(init): Adjust for new PluginProxySelector constructor.
+	* plugin/icedteanp/java/sun/applet/PluginProxySelector.java
+	(PluginProxySelector): New constructor.
+	* tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPProxySelectorTest.java:
+	New file.
+
 2013-09-20  Omair Majid  <omajid at redhat.com>
 
 	* netx/net/sourceforge/jnlp/InformationDesc.java
diff -r a5e65b8ac54c -r bd8e09edc806 netx/net/sourceforge/jnlp/browser/BrowserAwareProxySelector.java
--- a/netx/net/sourceforge/jnlp/browser/BrowserAwareProxySelector.java	Fri Sep 20 11:41:36 2013 -0400
+++ b/netx/net/sourceforge/jnlp/browser/BrowserAwareProxySelector.java	Mon Sep 23 12:34:25 2013 -0400
@@ -52,6 +52,7 @@
 import java.util.List;
 import java.util.Map;
 
+import net.sourceforge.jnlp.config.DeploymentConfiguration;
 import net.sourceforge.jnlp.runtime.JNLPProxySelector;
 import net.sourceforge.jnlp.runtime.JNLPRuntime;
 import net.sourceforge.jnlp.runtime.PacEvaluator;
@@ -92,8 +93,8 @@
     /**
      * Create a new instance of this class, reading configuration fropm the browser
      */
-    public BrowserAwareProxySelector() {
-        super();
+    public BrowserAwareProxySelector(DeploymentConfiguration config) {
+        super(config);
         try {
             initFromBrowserConfig();
         } catch (IOException e) {
diff -r a5e65b8ac54c -r bd8e09edc806 netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java
--- a/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java	Fri Sep 20 11:41:36 2013 -0400
+++ b/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java	Mon Sep 23 12:34:25 2013 -0400
@@ -36,8 +36,8 @@
 import java.util.Set;
 
 import javax.naming.ConfigurationException;
+
 import net.sourceforge.jnlp.cache.CacheLRUWrapper;
-
 import net.sourceforge.jnlp.runtime.JNLPRuntime;
 import net.sourceforge.jnlp.util.FileUtils;
 
@@ -126,6 +126,8 @@
     /*
      * Networking
      */
+
+    /** the proxy type. possible values are {@code JNLPProxySelector.PROXY_TYPE_*} */
     public static final String KEY_PROXY_TYPE = "deployment.proxy.type";
     public static final String KEY_PROXY_SAME = "deployment.proxy.same";
     public static final String KEY_PROXY_AUTO_CONFIG_URL = "deployment.proxy.auto.config.url";
diff -r a5e65b8ac54c -r bd8e09edc806 netx/net/sourceforge/jnlp/runtime/JNLPProxySelector.java
--- a/netx/net/sourceforge/jnlp/runtime/JNLPProxySelector.java	Fri Sep 20 11:41:36 2013 -0400
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPProxySelector.java	Mon Sep 23 12:34:25 2013 -0400
@@ -82,19 +82,14 @@
     // FIXME what is this? where should it be used?
     private String overrideHosts = null;
 
-    /**
-     * Creates a new JNLPProxySelector.
-     */
-    public JNLPProxySelector() {
-        parseConfiguration();
+    public JNLPProxySelector(DeploymentConfiguration config) {
+        parseConfiguration(config);
     }
 
     /**
      * Initialize this ProxySelector by reading the configuration
      */
-    private void parseConfiguration() {
-        DeploymentConfiguration config = JNLPRuntime.getConfiguration();
-
+    private void parseConfiguration(DeploymentConfiguration config) {
         proxyType = Integer.valueOf(config.getProperty(DeploymentConfiguration.KEY_PROXY_TYPE));
 
         String autoConfigString = config.getProperty(DeploymentConfiguration.KEY_PROXY_AUTO_CONFIG_URL);
@@ -240,7 +235,7 @@
                     return true;
                 }
             } else if (scheme.equals("socket")) {
-                String host = uri.getSchemeSpecificPart().split(":")[0];
+                String host = uri.getHost();
 
                 if (bypassLocal && isLocalHost(host)) {
                     return true;
@@ -368,7 +363,8 @@
      * suitable for java.
      * @param pacString a string indicating proxies. For example
      * "PROXY foo.bar:3128; DIRECT"
-     * @return a list of Proxy objects represeting the parsed string.
+     * @return a list of Proxy objects representing the parsed string. In
+     * case of malformed input, an empty list may be returned
      */
     public static List<Proxy> getProxiesFromPacResult(String pacString) {
         List<Proxy> proxies = new ArrayList<Proxy>();
diff -r a5e65b8ac54c -r bd8e09edc806 netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java
--- a/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java	Fri Sep 20 11:41:36 2013 -0400
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java	Mon Sep 23 12:34:25 2013 -0400
@@ -265,7 +265,7 @@
 
         // plug in a custom authenticator and proxy selector
         Authenticator.setDefault(new JNLPAuthenticator());
-        ProxySelector.setDefault(new BrowserAwareProxySelector());
+        ProxySelector.setDefault(new BrowserAwareProxySelector(config));
 
         // Restrict access to netx classes
         Security.setProperty("package.access", 
diff -r a5e65b8ac54c -r bd8e09edc806 plugin/icedteanp/java/sun/applet/PluginMain.java
--- a/plugin/icedteanp/java/sun/applet/PluginMain.java	Fri Sep 20 11:41:36 2013 -0400
+++ b/plugin/icedteanp/java/sun/applet/PluginMain.java	Mon Sep 23 12:34:25 2013 -0400
@@ -231,7 +231,7 @@
             Authenticator.setDefault(new JNLPAuthenticator());
         }
         // override the proxy selector set by JNLPRuntime
-        ProxySelector.setDefault(new PluginProxySelector());
+        ProxySelector.setDefault(new PluginProxySelector(JNLPRuntime.getConfiguration()));
     }
 
     private static void setCookieHandler(PluginStreamHandler streamHandler) {
diff -r a5e65b8ac54c -r bd8e09edc806 plugin/icedteanp/java/sun/applet/PluginProxySelector.java
--- a/plugin/icedteanp/java/sun/applet/PluginProxySelector.java	Fri Sep 20 11:41:36 2013 -0400
+++ b/plugin/icedteanp/java/sun/applet/PluginProxySelector.java	Mon Sep 23 12:34:25 2013 -0400
@@ -43,6 +43,7 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import net.sourceforge.jnlp.config.DeploymentConfiguration;
 import net.sourceforge.jnlp.runtime.JNLPProxySelector;
 import net.sourceforge.jnlp.util.TimedHashMap;
 
@@ -59,6 +60,10 @@
 
     private TimedHashMap<String, Proxy> proxyCache = new TimedHashMap<String, Proxy>();
 
+    public PluginProxySelector(DeploymentConfiguration config) {
+        super(config);
+    }
+
     /**
      * Selects the appropriate proxy (or DIRECT connection method) for the given URI
      *
diff -r a5e65b8ac54c -r bd8e09edc806 tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPProxySelectorTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPProxySelectorTest.java	Mon Sep 23 12:34:25 2013 -0400
@@ -0,0 +1,321 @@
+/* JNLPProxySelectorTest.java
+   Copyright (C) 2013 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+package net.sourceforge.jnlp.runtime;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.fail;
+
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.Proxy;
+import java.net.Proxy.Type;
+import java.net.SocketAddress;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.UnknownHostException;
+import java.util.Arrays;
+import java.util.List;
+
+import net.sourceforge.jnlp.config.DeploymentConfiguration;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class JNLPProxySelectorTest {
+
+    private static final Proxy BROWSER_PROXY = new Proxy(Type.SOCKS, InetSocketAddress.createUnresolved("foo", 0xF00));
+
+    class TestProxySelector extends JNLPProxySelector {
+        public TestProxySelector(DeploymentConfiguration config) {
+            super(config);
+        }
+
+        @Override
+        protected List<Proxy> getFromBrowser(URI uri) {
+            return Arrays.asList(BROWSER_PROXY);
+        }
+    }
+
+    @Test
+    public void testNoProxy() throws URISyntaxException {
+        DeploymentConfiguration config = new DeploymentConfiguration();
+        config.setProperty(DeploymentConfiguration.KEY_PROXY_TYPE, String.valueOf(JNLPProxySelector.PROXY_TYPE_NONE));
+
+        JNLPProxySelector selector = new TestProxySelector(config);
+        List<Proxy> result = selector.select(new URI("http://example.org/"));
+
+        assertEquals(1, result.size());
+        assertEquals(Proxy.NO_PROXY, result.get(0));
+    }
+
+    @Test
+    public void testProxyBypassLocal() throws URISyntaxException, UnknownHostException {
+        final String LOCALHOST = InetAddress.getLocalHost().getHostName();
+
+        DeploymentConfiguration config = new DeploymentConfiguration();
+        config.setProperty(DeploymentConfiguration.KEY_PROXY_TYPE, String.valueOf(JNLPProxySelector.PROXY_TYPE_MANUAL));
+        config.setProperty(DeploymentConfiguration.KEY_PROXY_BYPASS_LOCAL, String.valueOf(true));
+
+        List<Proxy> result;
+        JNLPProxySelector selector = new TestProxySelector(config);
+
+        result = selector.select(new URI("http://127.0.0.1/"));
+
+        assertEquals(1, result.size());
+        assertEquals(Proxy.NO_PROXY, result.get(0));
+
+        result = selector.select(new URI("http://" + LOCALHOST + "/"));
+
+        assertEquals(1, result.size());
+        assertEquals(Proxy.NO_PROXY, result.get(0));
+
+        result = selector.select(new URI("socket://127.0.0.1/"));
+
+        assertEquals(1, result.size());
+        assertEquals(Proxy.NO_PROXY, result.get(0));
+
+        result = selector.select(new URI("socket://" + LOCALHOST + "/"));
+
+        assertEquals(1, result.size());
+        assertEquals(Proxy.NO_PROXY, result.get(0));
+    }
+
+    @Test
+    public void testLocalProxyBypassListIsIgnoredForNonLocal() {
+
+    }
+
+    @Test
+    public void testProxyBypassList() throws URISyntaxException {
+        DeploymentConfiguration config = new DeploymentConfiguration();
+        config.setProperty(DeploymentConfiguration.KEY_PROXY_TYPE, String.valueOf(JNLPProxySelector.PROXY_TYPE_MANUAL));
+        config.setProperty(DeploymentConfiguration.KEY_PROXY_BYPASS_LIST, "example.org");
+
+        JNLPProxySelector selector = new TestProxySelector(config);
+        List<Proxy> result;
+
+        result = selector.select(new URI("http://example.org/"));
+
+        assertEquals(1, result.size());
+        assertEquals(Proxy.NO_PROXY, result.get(0));
+
+        result = selector.select(new URI("socket://example.org/"));
+
+        assertEquals(1, result.size());
+        assertEquals(Proxy.NO_PROXY, result.get(0));
+    }
+
+    @Test
+    public void testManualHttpProxy() throws URISyntaxException {
+        String HTTP_HOST = "example.org";
+        int HTTP_PORT = 42;
+
+        DeploymentConfiguration config = new DeploymentConfiguration();
+        config.setProperty(DeploymentConfiguration.KEY_PROXY_TYPE, String.valueOf(JNLPProxySelector.PROXY_TYPE_MANUAL));
+        config.setProperty(DeploymentConfiguration.KEY_PROXY_HTTP_HOST, HTTP_HOST);
+        config.setProperty(DeploymentConfiguration.KEY_PROXY_HTTP_PORT, String.valueOf(HTTP_PORT));
+
+        JNLPProxySelector selector = new TestProxySelector(config);
+        List<Proxy> result = selector.select(new URI("http://example.org/"));
+
+        assertEquals(1, result.size());
+        assertEquals(new Proxy(Type.HTTP, new InetSocketAddress(HTTP_HOST, HTTP_PORT)), result.get(0));
+    }
+
+    @Test
+    public void testManualHttpsProxy() throws URISyntaxException {
+        String HTTPS_HOST = "example.org";
+        int HTTPS_PORT = 42;
+
+        DeploymentConfiguration config = new DeploymentConfiguration();
+        config.setProperty(DeploymentConfiguration.KEY_PROXY_TYPE, String.valueOf(JNLPProxySelector.PROXY_TYPE_MANUAL));
+        config.setProperty(DeploymentConfiguration.KEY_PROXY_HTTPS_HOST, HTTPS_HOST);
+        config.setProperty(DeploymentConfiguration.KEY_PROXY_HTTPS_PORT, String.valueOf(HTTPS_PORT));
+
+        JNLPProxySelector selector = new TestProxySelector(config);
+        List<Proxy> result = selector.select(new URI("https://example.org/"));
+
+        assertEquals(1, result.size());
+        assertEquals(new Proxy(Type.HTTP, new InetSocketAddress(HTTPS_HOST, HTTPS_PORT)), result.get(0));
+    }
+
+    @Test
+    public void testManualFtpProxy() throws URISyntaxException {
+        String FTP_HOST = "example.org";
+        int FTP_PORT = 42;
+
+        DeploymentConfiguration config = new DeploymentConfiguration();
+        config.setProperty(DeploymentConfiguration.KEY_PROXY_TYPE, String.valueOf(JNLPProxySelector.PROXY_TYPE_MANUAL));
+        config.setProperty(DeploymentConfiguration.KEY_PROXY_FTP_HOST, FTP_HOST);
+        config.setProperty(DeploymentConfiguration.KEY_PROXY_FTP_PORT, String.valueOf(FTP_PORT));
+
+        JNLPProxySelector selector = new TestProxySelector(config);
+        List<Proxy> result = selector.select(new URI("ftp://example.org/"));
+
+        assertEquals(1, result.size());
+        assertEquals(new Proxy(Type.HTTP, new InetSocketAddress(FTP_HOST, FTP_PORT)), result.get(0));
+    }
+
+    @Test
+    public void testManualSocksProxy() throws URISyntaxException {
+        String SOCKS_HOST = "example.org";
+        int SOCKS_PORT = 42;
+
+        DeploymentConfiguration config = new DeploymentConfiguration();
+        config.setProperty(DeploymentConfiguration.KEY_PROXY_TYPE, String.valueOf(JNLPProxySelector.PROXY_TYPE_MANUAL));
+        config.setProperty(DeploymentConfiguration.KEY_PROXY_SOCKS4_HOST, SOCKS_HOST);
+        config.setProperty(DeploymentConfiguration.KEY_PROXY_SOCKS4_PORT, String.valueOf(SOCKS_PORT));
+
+        JNLPProxySelector selector = new TestProxySelector(config);
+        List<Proxy> result = selector.select(new URI("socket://example.org/"));
+
+        assertEquals(1, result.size());
+        assertEquals(new Proxy(Type.SOCKS, new InetSocketAddress(SOCKS_HOST, SOCKS_PORT)), result.get(0));
+    }
+
+    @Test
+    public void testManualUnknownProtocolProxy() throws URISyntaxException {
+        DeploymentConfiguration config = new DeploymentConfiguration();
+        config.setProperty(DeploymentConfiguration.KEY_PROXY_TYPE, String.valueOf(JNLPProxySelector.PROXY_TYPE_MANUAL));
+
+        JNLPProxySelector selector = new TestProxySelector(config);
+        List<Proxy> result = selector.select(new URI("gopher://example.org/"));
+
+        assertEquals(1, result.size());
+        assertEquals(Proxy.NO_PROXY, result.get(0));
+    }
+
+    @Test
+    public void testManualSameProxy() throws URISyntaxException {
+        final String HTTP_HOST = "example.org";
+        final int HTTP_PORT = 42;
+
+        DeploymentConfiguration config = new DeploymentConfiguration();
+        config.setProperty(DeploymentConfiguration.KEY_PROXY_TYPE, String.valueOf(JNLPProxySelector.PROXY_TYPE_MANUAL));
+        config.setProperty(DeploymentConfiguration.KEY_PROXY_HTTP_HOST, HTTP_HOST);
+        config.setProperty(DeploymentConfiguration.KEY_PROXY_HTTP_PORT, String.valueOf(HTTP_PORT));
+        config.setProperty(DeploymentConfiguration.KEY_PROXY_SAME, String.valueOf(true));
+
+        JNLPProxySelector selector = new TestProxySelector(config);
+        List<Proxy> result;
+
+        result = selector.select(new URI("http://example.org/"));
+
+        assertEquals(1, result.size());
+        assertEquals(new Proxy(Type.HTTP, new InetSocketAddress(HTTP_HOST, HTTP_PORT)), result.get(0));
+
+        result = selector.select(new URI("socket://example.org/"));
+
+        assertEquals(1, result.size());
+        assertEquals(new Proxy(Type.SOCKS, new InetSocketAddress(HTTP_HOST, HTTP_PORT)), result.get(0));
+    }
+
+    @Test
+    public void testBrowserProxy() throws URISyntaxException {
+        DeploymentConfiguration config = new DeploymentConfiguration();
+        config.setProperty(DeploymentConfiguration.KEY_PROXY_TYPE, String.valueOf(JNLPProxySelector.PROXY_TYPE_BROWSER));
+
+        JNLPProxySelector selector = new TestProxySelector(config);
+        List<Proxy> result = selector.select(new URI("http://example.org/"));
+
+        assertEquals(1, result.size());
+        assertSame(BROWSER_PROXY, result.get(0));
+    }
+
+    @Test
+    public void testMissingProxyAutoConfigUrl() throws URISyntaxException {
+        DeploymentConfiguration config = new DeploymentConfiguration();
+        config.setProperty(DeploymentConfiguration.KEY_PROXY_TYPE, String.valueOf(JNLPProxySelector.PROXY_TYPE_AUTO));
+
+        JNLPProxySelector selector = new TestProxySelector(config);
+        List<Proxy> result = selector.select(new URI("http://example.org/"));
+
+        assertEquals(1, result.size());
+        assertEquals(Proxy.NO_PROXY, result.get(0));
+    }
+
+    // TODO
+    @Ignore("Need to find a way to inject a custom proxy autoconfig file first")
+    @Test
+    public void testProxyAutoConfig() throws URISyntaxException {
+        DeploymentConfiguration config = new DeploymentConfiguration();
+        config.setProperty(DeploymentConfiguration.KEY_PROXY_TYPE, String.valueOf(JNLPProxySelector.PROXY_TYPE_AUTO));
+        config.setProperty(DeploymentConfiguration.KEY_PROXY_AUTO_CONFIG_URL, "foobar");
+
+        JNLPProxySelector selector = new TestProxySelector(config);
+        List<Proxy> result = selector.select(new URI("http://example.org/"));
+
+        assertEquals(1, result.size());
+    }
+
+    // TODO this JNLPProxySelect#getProxiesFromPacResult should be moved into a different class
+    // TODO this test should be split into different methods
+    @Test
+    public void testConvertingProxyAutoConfigResultToProxyObject() {
+        List<Proxy> result;
+
+        result = JNLPProxySelector.getProxiesFromPacResult("foo bar baz; what is this; dunno");
+        assertEquals(0, result.size());
+
+        result = JNLPProxySelector.getProxiesFromPacResult("DIRECT");
+        assertEquals(1, result.size());
+        assertEquals(Proxy.NO_PROXY, result.get(0));
+
+        result = JNLPProxySelector.getProxiesFromPacResult("PROXY foo:42");
+        assertEquals(1, result.size());
+        assertEquals(new Proxy(Type.HTTP, InetSocketAddress.createUnresolved("foo", 42)), result.get(0));
+
+        result = JNLPProxySelector.getProxiesFromPacResult("PROXY foo:bar");
+        assertEquals(0, result.size());
+
+        result = JNLPProxySelector.getProxiesFromPacResult("PROXY foo");
+        assertEquals(0, result.size());
+
+        result = JNLPProxySelector.getProxiesFromPacResult("SOCKS foo:42");
+        assertEquals(1, result.size());
+        assertEquals(new Proxy(Type.SOCKS, InetSocketAddress.createUnresolved("foo", 42)), result.get(0));
+
+        result = JNLPProxySelector.getProxiesFromPacResult("SOCKS foo:bar");
+        assertEquals(0, result.size());
+
+        result = JNLPProxySelector.getProxiesFromPacResult("SOCKS foo");
+        assertEquals(0, result.size());
+
+    }
+}


More information about the distro-pkg-dev mailing list