Java 8 Proxy - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Proxy class.

This code example shows how to use the following methods: address, type
		factoryBean.setPort(port);
		factoryBean.afterPropertiesSet();
 
		Proxy result = factoryBean.getObject();
 
		assertEquals(type, result.type());
		InetSocketAddress address = (InetSocketAddress) result.address();
		assertEquals(hostname, address.getHostName());
		assertEquals(port, address.getPort());
	} 
 
} 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
    if (strs.length != 2)
      throw new RuntimeException("Bad SOCKS proxy parameter: " + proxyStr);
    String host = strs[0];
    int port = Integer.parseInt(strs[1]);
    this.proxy =
        new Proxy(Proxy.Type.SOCKS, InetSocketAddress.createUnresolved(host,
            port));
  } 
} 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: address, toString, type
 
	/** 
	 * @tests java.net.Proxy#toString() 
	 */ 
	public void test_toString() { 
		Proxy proxy = new Proxy(Proxy.Type.HTTP, address);
		// include type String 
		assertTrue(proxy.toString().indexOf(proxy.type().toString()) != -1);
		// include address String 
		assertTrue(proxy.toString().indexOf(proxy.address().toString()) != -1);
 
		proxy = new Proxy(Proxy.Type.SOCKS, address);
		// include type String 
		assertTrue(proxy.toString().indexOf(proxy.type().toString()) != -1);
		// include address String 
		assertTrue(proxy.toString().indexOf(proxy.address().toString()) != -1);
 
		proxy = Proxy.NO_PROXY;
		// include type String 
		assertTrue(proxy.toString().indexOf(proxy.type().toString()) != -1);
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: address, type
    } 
    return null; 
  } 
 
  private InetAddress getConnectToInetAddress(Proxy proxy, URL url) throws IOException {
    return (proxy != null && proxy.type() != Proxy.Type.DIRECT)
        ? ((InetSocketAddress) proxy.address()).getAddress()
        : InetAddress.getByName(url.getHost());
  } 
} 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
		Assert.notNull(type, "'type' must not be null"); 
		Assert.hasLength(hostname, "'hostname' must not be empty"); 
		Assert.isTrue(port >= 0 && port <= 65535, "'port' out of range: " + port); 
 
		SocketAddress socketAddress = new InetSocketAddress(hostname, port); 
		this.proxy = new Proxy(type, socketAddress); 
 
	} 
 
	@Override 
	public Proxy getObject() { 
		return proxy; 
	} 
 
	@Override 
	public Class<?> getObjectType() { 
		return Proxy.class; 
	} 
 
	@Override 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
See Code Examples for Java 8 Proxy Methods: