Returns true when proxy should by bypassed for host.
777507
def proxy_bypass? host, port
    host = host.downcase
    host_port = [host, port].join ':'

    @no_proxy.each do |name|
      return true if host[-name.length, name.length] == name or
         host_port[-name.length, name.length] == name
    end

    false
  end
1343526
public void setHttpsProxy(String host) {
    setProxyValue(HTTPS_SERVER, host);
    setProxyValue(USE_HTTPS, host != null);
  }
201875
private boolean isProxied(HttpServletRequest httpServletRequest) {
        if (Proxy.isProxyClass(httpServletRequest.getClass())) {
            InvocationHandler handler = Proxy.getInvocationHandler(httpServletRequest);
            return handler instanceof ServletRequestInvocationHandler;
        }
        return false;
    }
374885
private void onOK() {
		host = host_text.getText().trim();
		user = user_text.getText();
		password = password_text.getText();

		if (host.length() == 0) {
			warn("Proxy host is not set!");
			return;
		}
		if (socks_group.getSelectedCheckbox() == socks4radio) {
			if (user.length() == 0) {
				warn("User name is not set");
				return;
			}

		} else {
			if (up_check.getState()) {
				if (user.length() == 0) {
					warn("User name is not set.");
					return;
				}
				if (password.length() == 0) {
					warn("Password is not set.");
					return;
				}
			} else if (!none_check.getState()) {
				warn("Please select at least one Authentication Method.");
				return;
			}
		}

		try {
			port = Integer.parseInt(port_text.getText());
		} catch (NumberFormatException nfe) {
			warn("Proxy port is invalid!");
			return;
		}

		mode = OK_MODE;

		if (useThreads) {
			net_thread = new Thread(this);
			net_thread.start();

			info("Looking up host: " + host);
			// System.out.println("Info returned.");
		} else if (!initProxy()) {
			warn("Proxy host is invalid.");
			mode = COMMAND_MODE;
		}

		if (mode == OK_MODE)
			dispose();
	}
1110957
public boolean checkIfChanged(Collection<Host> hostsUp, Collection<Host> hostsDown) {
		boolean changed = activeSetChanged(hostsUp) || inactiveSetChanged(hostsUp, hostsDown);

		if (changed && logger.isDebugEnabled()) {
			Set<Host> changedHostsUp = new HashSet<>(hostsUp);
			changedHostsUp.removeAll(activeHosts);
			changedHostsUp.forEach(x -> logger.debug("New host up: {}", x.getHostAddress()));

			Set<Host> changedHostsDown = new HashSet<>(hostsDown);
			changedHostsDown.removeAll(inactiveHosts);
			changedHostsDown.forEach(x -> logger.debug("New host down: {}", x.getHostAddress()));
		}
		return changed;
	}
405345
public static boolean shouldProxy(Properties props) {
    String shouldProxy = props.getProperty(HadoopSecurityManager.ENABLE_PROXYING);
    return shouldProxy != null && shouldProxy.equals("true");
  }
449425
def _should_proxy(self, attr):
        
        if attr in type(self).__notproxied__:
            return False
        if _oga(self, "__notproxied__") is True:
            return False
        return True
271926
def select_proxy(url, proxies):
    
    proxies = proxies or {}
    urlparts = urlparse(url)
    if urlparts.hostname is None:
        return proxies.get(urlparts.scheme, proxies.get('all'))

    proxy_keys = [
        urlparts.scheme + '://' + urlparts.hostname,
        urlparts.scheme,
        'all://' + urlparts.hostname,
        'all',
    ]
    proxy = None
    for proxy_key in proxy_keys:
        if proxy_key in proxies:
            proxy = proxies[proxy_key]
            break

    return proxy
701322
def is_usable(host, port, timeout=3):
    
    try:
        proxies = {
            'http': 'http://%s:%s' % (host, port),
            'https': 'https://%s:%s' % (host, port)
        }
        requests.get('http://www.baidu.com/', proxies=proxies, timeout=timeout)
    except HTTPError:
        print('failed: ', host, port)
        return False
    else:
        print('success: ', host, port)
        return True
1032031
private Proxy lookupProxy(String hostKey, String portKey, Proxy.Type type, int defaultPort) {
        String host = System.getProperty(hostKey);
        if (host == null || host.isEmpty()) {
            return null;
        }

        int port = getSystemPropertyInt(portKey, defaultPort);
        return new Proxy(type, InetSocketAddress.createUnresolved(host, port));
    }
1145605
def _is_proxy_running(proxyname):
    '''
    
    '''
    cmd = ('ps ax | grep "salt-proxy --proxyid={0}" | grep -v grep'
           .format(salt.ext.six.moves.shlex_quote(proxyname)))
    cmdout = __salt__['cmd.run_all'](
        cmd,
        timeout=5,
        python_shell=True)
    if not cmdout['stdout']:
        return False
    else:
        return True
969750
public void setSocksProxy(String host) {
    assertNotMobile();
    setProxyValue(SOCKS_SERVER, host);
    setProxyValue(USE_SOCKS, host != null);
  }
1275971
private boolean stopRejoiningHost() {

        // The host failure notification could come before mesh determination, wait for the determination
        try {
            m_meshDeterminationLatch.await();
        } catch (InterruptedException e) {
        }

        if (m_rejoining) {
            VoltDB.crashLocalVoltDB("Another node failed before this node could finish rejoining. " +
                    "As a result, the rejoin operation has been canceled. Please try again.");
            return true;
        }
        return false;
    }
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));
    }
49701
@Override
	public void setProxyHostPort(String hostPort) {
    	int colonIdx = hostPort.indexOf(':');
    	if(colonIdx > 0) {
    		String host = hostPort.substring(0,colonIdx);
    		int port = Integer.valueOf(hostPort.substring(colonIdx+1));
    		
//            http.getHostConfiguration().setProxy(host, port);
    		hostConfiguration.setProxy(host, port);
    	}
    }
11772
public static void setJVMProxy(String host, String port) {
		System.setProperty(JVM_PROXY_HOST_PROPERTY, host);
		System.setProperty(JVM_PROXY_PORT_PROPERTY, port);
	}
879451
public void setProxy(String proxyHost, int proxyPort) {
         this.proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort));
     }