Code example for Proxy

Methods: addresstype

    static String toString(Proxy proxy) {
        if (proxy == Proxy.NO_PROXY)
            return "DIRECT"; 
        // only knows about http and socks proxies. 
        Proxy.Type type = proxy.type();
        switch (type) {
        case HTTP: return "PROXY " + proxy.address().toString();
        case SOCKS: return "SOCKS5 " + proxy.address().toString();
        case DIRECT: return "DIRECT";
            // If a new proxy type is supported in future, add a case to match it. 
            fail("Unknown proxy type" + type);
            return "unknown://"; 
    static String toString(List<Proxy> proxies) {
        StringBuilder builder = new StringBuilder();
        for (Proxy proxy : proxies) {