turn on proxy support
@param proxyHost proxy host address eg "proxy.mycorp.com"
@param proxyPort proxy port usually 80 or 8080
488053
function setProxy($proxyHost, $proxyPort) {
      $this->useProxy = true;
      $this->proxyHost = $proxyHost;
      $this->proxyPort = $proxyPort;
    }
1338345
public void setProxyTimeout(int seconds) {
		if(seconds<=0) throw new IllegalArgumentException("Negative or zero timeout not allowed");
		
		proxyTimeout = seconds;
		for(ProxyBranchImpl proxyBranch : proxyBranches.values()) {	
			final boolean inactive = proxyBranch.isCanceled() || proxyBranch.isTimedOut();
			
			if(!inactive) {
				proxyBranch.setProxyBranchTimeout(seconds);
			}
		}

	}
49546
public static function useProxy($host, $port, $username = null, $password = null) {
    Connect2PayCurrencyHelper::$proxy_host = $host;
    Connect2PayCurrencyHelper::$proxy_port = $port;
    Connect2PayCurrencyHelper::$proxy_username = $username;
    Connect2PayCurrencyHelper::$proxy_password = $password;
  }
943685
public static SocksProxyTransport connectViaSocks4Proxy(String remoteHost,
			int remotePort, String proxyHost, int proxyPort, String userId)
			throws IOException, UnknownHostException {
		SocksProxyTransport proxySocket = new SocksProxyTransport(remoteHost,
				remotePort, proxyHost, proxyPort, SOCKS4);
		proxySocket.username = userId;
		try {
			InputStream proxyIn = proxySocket.getInputStream();
			OutputStream proxyOut = proxySocket.getOutputStream();
			InetAddress hostAddr = InetAddress.getByName(remoteHost);
			proxyOut.write(SOCKS4);
			proxyOut.write(CONNECT);
			proxyOut.write((remotePort >>> 8) & 0xff);
			proxyOut.write(remotePort & 0xff);
			proxyOut.write(hostAddr.getAddress());
			proxyOut.write(userId.getBytes());
			proxyOut.write(NULL_TERMINATION);
			proxyOut.flush();

			int res = proxyIn.read();

			if (res == -1) {
				throw new IOException("SOCKS4 server " + proxyHost + ":"
						+ proxyPort + " disconnected");
			}

			if (res != 0x00) {
				throw new IOException("Invalid response from SOCKS4 server ("
						+ res + ") " + proxyHost + ":" + proxyPort);
			}

			int code = proxyIn.read();

			if (code != 90) {
				if ((code > 90) && (code < 93)) {
					throw new IOException(
							"SOCKS4 server unable to connect, reason: "
									+ SOCKSV4_ERROR[code - 91]);
				}
				throw new IOException(
						"SOCKS4 server unable to connect, reason: " + code);
			}

			byte[] data = new byte[6];

			if (proxyIn.read(data, 0, 6) != 6) {
				throw new IOException(
						"SOCKS4 error reading destination address/port");
			}

			proxySocket.setProviderDetail(data[2] + "." + data[3] + "."
					+ data[4] + "." + data[5] + ":"
					+ ((data[0] << 8) | data[1]));
		} catch (SocketException e) {
			throw new SocketException("Error communicating with SOCKS4 server "
					+ proxyHost + ":" + proxyPort + ", " + e.getMessage());
		}

		return proxySocket;
	}
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;
    }
427000
@VisibleForTesting
  static URI parseProxyAddress(@Nullable String proxyAddress) {
    if (Strings.isNullOrEmpty(proxyAddress)) {
      return null;
    }
    String uriString = (proxyAddress.contains("//") ? "" : "//") + proxyAddress;
    try {
      URI uri = new URI(uriString);
      String scheme = uri.getScheme();
      String host = uri.getHost();
      int port = uri.getPort();
      checkArgument(
          Strings.isNullOrEmpty(scheme) || scheme.matches("https?"),
          "HTTP proxy address '%s' has invalid scheme '%s'.", proxyAddress, scheme);
      checkArgument(!Strings.isNullOrEmpty(host), "Proxy address '%s' has no host.", proxyAddress);
      checkArgument(port != -1, "Proxy address '%s' has no port.", proxyAddress);
      checkArgument(
          uri.equals(new URI(scheme, null, host, port, null, null, null)),
          "Invalid proxy address '%s'.", proxyAddress);
      return uri;
    } catch (URISyntaxException e) {
      throw new IllegalArgumentException(
          String.format("Invalid proxy address '%s'.", proxyAddress), e);
    }
  }
910180
func (h *Handler) ProxyHostPort() string {
	// addr equals to "localhost:8030" at this point
	addr := h.cfg.ProxyWebAddr.String()
	// add the SSH port number and return
	_, sshPort, err := net.SplitHostPort(h.cfg.ProxySSHAddr.String())
	if err != nil {
		log.Error(err)
		sshPort = strconv.Itoa(defaults.SSHProxyListenPort)
	}
	return fmt.Sprintf("%s,%s", addr, sshPort)
}
586921
function setProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '', $proxyauthtype = 'basic') {
		if ($proxyhost) {
			$this->proxy = array(
				'host' => $proxyhost,
				'port' => $proxyport,
				'username' => $proxyusername,
				'password' => $proxypassword,
				'authtype' => $proxyauthtype
			);
			if ($proxyusername != '' && $proxypassword != '' && $proxyauthtype = 'basic') {
				$this->setHeader('Proxy-Authorization', ' Basic '.base64_encode($proxyusername.':'.$proxypassword));
			}
		} else {
			$this->debug('remove proxy');
			$proxy = null;
			unsetHeader('Proxy-Authorization');
		}
	}
31578
public HttpHost getProxy(ProxyConfig proxyConfig) {
		if (proxyConfig == null) {
			return null;
		}
		String host = proxyConfig.getHost();
		String port = proxyConfig.getPort();
		HttpHost proxy = null;
		if (!host.isEmpty() && !port.isEmpty()) {
			proxy = new HttpHost(host, Integer.parseInt(port));

		}
		return proxy;
	}
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;
    }
454289
public static void setDefaultProxy(String hostName,int port,String user)
                             throws UnknownHostException{
      defaultProxy = new Socks4Proxy(hostName,port,user);
   }
97812
def set_proxy(self, host     = "localhost",
                      port     = 0,
                      user     = "",
                      password = ""):
    
    self.conn.issue_command("SetProxy", host, port, user, password)
375048
public static Proxy httpProxy(String host, int port) {
        return new Proxy(Proxy.Type.HTTP, new InetSocketAddress(Objects.requireNonNull(host), port));
    }
930880
public function SetLocalProxy($proxyUrl)
	{
		if ($proxyUrl == null || empty($proxy))
		{
			$this->proxy = null;
			return;
		}
		
		$url_parts = parse_url($proxyUrl);
		
		$this->proxy = new stdClass();
		$this->proxy->host = $url_parts['host'];
		$this->proxy->port = $url_parts['port'];
		$this->proxy->username = null;
		$this->proxy->password = null;
		
		if (isset($url_parts['user']))
		{
			$this->proxy->username = urldecode($url_parts['user']);
		}
		if (isset($url_parts['pass']))
		{
			$this->proxy->password = urldecode($url_parts['pass']);
		}
	}
614378
public static Proxy forPropertiesOpt(String prefix) {
        String host;
        String port;
        Proxy result;

        host = System.getProperty(prefix + ".proxyHost");
        if (host == null) {
            return null;
        }
        port = System.getProperty(prefix + ".proxyPort");
        if (port == null) {
            throw new IllegalStateException("missing proxy port for host " + host);
        }
        result = new Proxy(host, Integer.parseInt(port));
        result.excludes.addAll(NON_PROXY_SEP.split(System.getProperty(prefix + ".nonProxyHosts", "")));
        return result;
    }
1197554
private void setProxy(String proxyStr) {
    String[] strs = proxyStr.split(":", 2);
    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));
  }
809914
function Proxy(host, port, user, pass) {
  if (!(this instanceof Proxy))
    return new Proxy(host, port, user, pass);

  EventEmitter.call(this);

  assert(typeof host === 'string');
  assert(typeof port === 'number');

  this.socket = null;
  this.host = host;
  this.port = port;
  this.username = user || null;
  this.password = pass || null;
  this.bytesWritten = 0;
  this.bytesRead = 0;
  this.remoteAddress = null;
  this.remotePort = 0;
  this.ops = [];
}