Configure a proxy to use for HTTPS connections created anywhere in the JVM (not recommended).

@param host the proxyHost
@param port the proxyPort
11772
public static void setJVMProxy(String host, String port) {
		System.setProperty(JVM_PROXY_HOST_PROPERTY, host);
		System.setProperty(JVM_PROXY_PORT_PROPERTY, port);
	}
1225229
public static void setDefaultProxy(InetAddress ipAddress,int port,
                                      String user){
      defaultProxy = new Socks4Proxy(ipAddress,port,user);
   }
820812
public static InetSocketAddress buildInetSocketAddress(String host, int defaultPort) {
		if (StrUtil.isBlank(host)) {
			host = LOCAL_IP;
		}

		String destHost = null;
		int port = 0;
		int index = host.indexOf(":");
		if (index != -1) {
			// host:port形式
			destHost = host.substring(0, index);
			port = Integer.parseInt(host.substring(index + 1));
		} else {
			destHost = host;
			port = defaultPort;
		}

		return new InetSocketAddress(destHost, port);
	}
859427
public Proxy setHost( String host )
    {
        if ( this.host.equals( host ) || ( host == null && this.host.length() <= 0 ) )
        {
            return this;
        }
        return new Proxy( type, host, port, auth );
    }
1051867
public void setProxy(String proxyHost, int proxyPort, String username, String password) {
        setProxy(proxyHost, proxyPort);
        proxyAuth = true;
        proxyUser = username;
        proxyPassword = password;
    }
1348747
public function setProxy($host = null, $port = null)
    {
        parent::setProxy($host, $port);

        if ($this->curl) {
            if ($this->proxyHost) {
                curl_setopt($this->curl, CURLOPT_PROXY, $this->proxyHost);
                curl_setopt($this->curl, CURLOPT_PROXYPORT, $this->proxyPort);
            } else {
                curl_setopt($this->curl, CURLOPT_PROXY, '');
            }
        }
    }
97812
def set_proxy(self, host     = "localhost",
                      port     = 0,
                      user     = "",
                      password = ""):
    
    self.conn.issue_command("SetProxy", host, port, user, password)
1223529
public void removeConnectionPool(String host, int port) {
        RequestBuilder req = new RequestBuilder();
        req.host = host;
        req.port = port;
        removePool(req);
    }
482531
public void activate(InetAddress host, int port, Collection<String> nonProxyHosts) {
        for (String scheme : new String[] {"http", "https"}) {
            String currentProxyHost = System.getProperty(scheme + ".proxyHost");
            String currentProxyPort = System.getProperty(scheme + ".proxyPort");
            if (currentProxyHost != null) {
                originalProxies.put(scheme, new InetSocketAddress(currentProxyHost, Integer.parseInt(currentProxyPort)));
            }
            System.setProperty(scheme + ".proxyHost", new InetSocketAddress(host, port).getHostString());
            System.setProperty(scheme + ".proxyPort", Integer.toString(port));
        }

        String currentNonProxyHosts = System.getProperty("http.nonProxyHosts");
        if (currentNonProxyHosts == null) {
            originalNonProxyHosts.clear();
        } else {
            for (String nonProxyHost : Splitter.on('|').split(currentNonProxyHosts)) {
                originalNonProxyHosts.add(nonProxyHost);
            }
        }
        System.setProperty("http.nonProxyHosts", Joiner.on('|').join(nonProxyHosts));
    }
112600
public void setSocketProxy(String host, int port) {
        if (config == null) {
            config = new AipClientConfiguration();
        }
        this.config.setProxy(host, port, Proxy.Type.SOCKS);
    }
318633
private static CloseableHttpClient wrapClient(String host) {

        CloseableHttpClient httpClient = HttpClientBuilder.create().build();

        if (host.startsWith("https://")) {
            httpClient = sslClient();
        }

        return httpClient;
    }
345593
public static void disableProxy() {
        System.clearProperty("http.proxyHost");
        System.clearProperty("http.proxyPort");
        System.clearProperty("http.proxyUserName");
        System.clearProperty("http.proxyUser");
        System.clearProperty("http.proxyPassword");
        System.clearProperty("https.proxyHost");
        System.clearProperty("https.proxyPort");
        System.clearProperty("https.proxyUserName");
        System.clearProperty("https.proxyUser");
        System.clearProperty("https.proxyPassword");

        _url = null;
        _port = null;
        _user = null;
        _pwd = null;
        hasProxy = false;
    }
1037833
public void setProxy(String host, int port, String user, String pwd) {
		this.proxy = new Proxy(host, port, user, pwd);
	}
821339
public static com.sun.net.httpserver.HttpServer bind(InetAddress address, int startPort, int maxPort) {
        com.sun.net.httpserver.HttpServer aServer = createServer();
        int port = -1;
        for (int possiblePort = startPort; port == -1 && possiblePort <= maxPort; possiblePort++) {
            try {
                InetSocketAddress s = new InetSocketAddress(address, possiblePort);
                aServer.bind(s, 1);
                port = possiblePort;
            } catch (IOException e) {
                // try next number
                continue;
            }
        }
        if (aServer.getAddress() == null) {
            throw new RuntimeException(new BindException("Unable to bind to: " + address.getHostAddress()));
        }
        return aServer;
    }
724807
protected Socket openSocket(String host, int port)
	throws IOException {
        return SocketFactory.getDefault().createSocket(host, port);
    }
652693
public function useProxy($host = self::DEFAULT_PROXY_HOST, $port = self::DEFAULT_PROXY_PORT, $type = self::DEFAULT_PROXY_TYPE)
    {
        $this->proxyType = $type;
        $this->proxyHost = $host;
        $this->proxyPort = $port;
        return $this;
    }
798241
public void setFtpProxy(String host) {
    setProxyValue(FTP_SERVER, host);
    setProxyValue(USE_FTP, host != null);
  }