Set a proxy server for outgoing requests to tunnel through.

@param string $server
@param int|bool $port optional port number
972017
public function useProxy($server, $port = false)
    {
        curl_setopt($this->curl, CURLOPT_PROXY, $server);

        if ($port) {
            curl_setopt($this->curl, CURLOPT_PROXYPORT, $port);
        }
    }
802560
public void setProxy(String proxyhost, int proxyport) {
		proxy = new java.net.Proxy(java.net.Proxy.Type.HTTP, new InetSocketAddress(proxyhost, proxyport));
	}
1211955
function setCurrentServer(server) {
    if (server) {
        server.makeCurrent();
        assert.strictEqual(getCurrentServer(), server);
    }
    else {
        init.initOptions.serverUrl = null;
    }
}
878505
public function setServerStatus($serverName, $action = 'enable', $proxyName = 'all')
	{
		// perform action on all proxies where server exists
		if ($proxyName == 'all') {
			$proxyNames = array();
			$stats = $this->getStatsByProxy();

			foreach ($stats as $proxyName => $serviceNames) {
				if (array_key_exists($serverName, $serviceNames)) {
					$proxyNames[] = $proxyName;
				}
			}
		} else {
			$proxyNames = array($proxyName);
		}

		foreach ($proxyNames as $proxyName) {
			try {
				$this->_client->setMethod(Request::METHOD_POST);
				$this->_client->setParameterPost(
					array(
						 's'      => $serverName,
						 'b'      => $proxyName,
						 'action' => $action
					)
				);
				$this->_client->send();
			} catch (\Exception $e) {
				$this->_log('crit', "Exception: " . $e->getCode() . '-' . $e->getMessage());
				$this->_log('debug', "Exception Trace: " . $e->getTraceAsString());
			}

			$response = $this->_client->getResponse();

			if ($response->isSuccess()) {
				$this->_log('info', ucwords($action) . "d '$serverName' in proxy '$proxyName' on $this->_serverFqdn");

				// get the status notice displayed on the page
				/** @noinspection PhpUndefinedMethodInspection */
				$notice = str_replace(array('[X]', '.'), '', qp($response->getBody(), 'div')->text());
				$this->_log('debug', "HAProxy response on $this->_serverFqdn: $notice");
			} else {
				$this->_log('err', "Failed to $action '$serverName' in proxy '$proxyName' on $this->_serverFqdn");
				$this->_log('debug', "Response: " . $response->getStatusCode() . ' - ' . $response->getReasonPhrase());
			}
		}
	}
193765
public function setPort($port)
    {
        if (preg_match(self::PATTERN_MATCH_PORT, $port) !== 1) {
            throw new \InvalidArgumentException('"' . $port . '" is not valid port number as part of a URI.', 1184071241);
        }

        $this->port = (integer)$port;
    }
632169
public function setPort($port)
        {
            if ($this->validatePort($port) === false) {
                throw new Exception("Port \"$port\" is not a valid HTTP port.");
            }

            $oldPort     = $this->_port;
            $this->_port = $port;

            return $oldPort;
        }
4079
public function setServerParams($host, $port = 11211, $timeout = NULL, $retry_interval = false, $status = NULL, $failure_callback = NULL)
    {
    }
471355
public function connect($host, $port = 80, $secure = false)
    {
        // If no proxy is set, fall back to Socket adapter
        if (!$this->config['proxy_host']) {
            return parent::connect($host, $port, $secure);
        }

        /* Url might require stream context even if proxy connection doesn't */
        if ($secure) {
            $this->config['sslusecontext'] = true;
        }

        // Connect (a non-secure connection) to the proxy server
        return parent::connect(
            $this->config['proxy_host'],
            $this->config['proxy_port'],
            false
        );
    }
1037255
function connect($host, $port = '' )
    {
        if (!is_numeric($port))
        {
            $port = 80;
        }

        $this->remote_host = $host;
        $this->remote_port = $port;
    }
1090487
public function useProxy($host = self::DEFAULT_PROXY_HOST, $port = self::DEFAULT_PROXY_PORT, $type = self::DEFAULT_PROXY_TYPE)
    {
        $this->setProxyType($type);
        $this->setProxyHost($host);
        $this->setProxyPort($port);

        return $this;
    }
362912
private function accept(SocketServer $server): Generator
    {
        yield from log()->log(
            Log::INFO,
            'NNTP server listening on %s:%d',
            $server->getAddress(),
            $server->getPort()
        );

        while ($server->isOpen()) {
            // Wait for a client to connect.
            $socket = yield from $server->accept();

            // Handle the client in a separate coroutine.
            $coroutine = new Coroutine($this->handleClient($socket));
            $coroutine->done();
        }
    }
1315016
private function setProxy($proxy, $onlyProtocol = null)
    {
        $proxy = trim($proxy);
        if (null == $onlyProtocol) {
            $this->proxySettings['http'] = $proxy;
            $this->proxySettings['https'] = $proxy;
        } else {
            $this->proxySettings[$onlyProtocol] = $proxy;
        }
    }
1046105
public function setProxyPort($proxyPort)
    {
        if ($proxyPort != null && preg_match('/^d{4}$/', $proxyPort) !== 1) {
            if ($this->isTestSystem()) {
                throw new InvalidArgumentException("The proxy port '$proxyPort' you have given must be numeric!");
            } else {
                throw new Exception();
            }
        }

        $this->proxyPort = $proxyPort;
    }
556355
public function set($transport, $ip, $port, $timeout = 3, $blocking = false)
    {

        $this->transport = $transport;

        $this->ip = $ip;

        $this->port = $port;

        $this->timeout = $timeout;

        $this->blocking = $blocking;
    }
112600
public void setSocketProxy(String host, int port) {
        if (config == null) {
            config = new AipClientConfiguration();
        }
        this.config.setProxy(host, port, Proxy.Type.SOCKS);
    }
1135730
public function setPort($port = null)
    {
        if (is_null($port)) {
            $port = ($this->_protocol == 'ssl') ? 465 : 25;
        }

        $this->_port = $port;
    }
1222608
public function setPort(/* integer */ $port) {
		// Close connection before changing port.
		if ($this->port !== $port) {
			$this->close();
			$this->port = $port;
		}
	}