/** Tests select(URI) NO_PROXY */ @Test public void testSelect_Direct() { JaxWsProxySelector ps = new JaxWsProxySelector(ProxySelector.getDefault()); ProxySelector.setDefault(ps); List<Proxy> list = ps.select(testHttpUri); assertEquals(list.get(0), Proxy.NO_PROXY); }
/** Tests select(URI) HTTS */ @Test public void testSelect_HTTPS() throws UnknownHostException { System.getProperties().put(HTTPS_PROXY_HOST, "127.0.0.1"); System.getProperties().put(HTTPS_PROXY_PORT, "8888"); JaxWsProxySelector ps = new JaxWsProxySelector(ProxySelector.getDefault()); ProxySelector.setDefault(ps); List<Proxy> list = ps.select(testHttpsUri); assertEquals( list.get(0), new Proxy(Type.HTTP, new InetSocketAddress(InetAddress.getByName("127.0.0.1"), 8888))); System.getProperties().remove(HTTPS_PROXY_HOST); System.getProperties().remove(HTTPS_PROXY_PORT); }
/** Tests the connectFailed(URI, SocketAddress, IOException) */ @Test(expected = IllegalArgumentException.class) public void testConnectFailed() { JaxWsProxySelector ps = new JaxWsProxySelector(ProxySelector.getDefault()); ps.connectFailed(null, null, null); }
/** Tests select(URI) IllegalArgumentException */ @Test(expected = IllegalArgumentException.class) public void testSelect_IllegalArgumentException() { JaxWsProxySelector ps = new JaxWsProxySelector(ProxySelector.getDefault()); ps.select(null); }