コード例 #1
0
  /** 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);
  }
コード例 #2
0
  /** 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);
  }
コード例 #3
0
 /** Tests the connectFailed(URI, SocketAddress, IOException) */
 @Test(expected = IllegalArgumentException.class)
 public void testConnectFailed() {
   JaxWsProxySelector ps = new JaxWsProxySelector(ProxySelector.getDefault());
   ps.connectFailed(null, null, null);
 }
コード例 #4
0
 /** Tests select(URI) IllegalArgumentException */
 @Test(expected = IllegalArgumentException.class)
 public void testSelect_IllegalArgumentException() {
   JaxWsProxySelector ps = new JaxWsProxySelector(ProxySelector.getDefault());
   ps.select(null);
 }