Code example for Proxy

Methods: address, type

0
    private String host;
    private int port;
 
    public ProxyInfo(final Proxy proxy) {
        this.proxy = proxy;
        if (proxy.type() == Proxy.Type.HTTP) {
            InetSocketAddress addr = (InetSocketAddress) proxy.address();
            if (addr != null) {
                this.host = addr.getHostName();
                this.port = addr.getPort();
            } 
        } 
    } 
 
    public Proxy getProxy() {
        return proxy;
    } 
 
    public String getHost() {
        return host;
    }