code: protected Proxy getProxy(final Settings settings, final String serverId, final String host) {
  		if (settings == null)
  			return null;
  		List<Proxy> proxies = settings.getProxies();
  		if (proxies == null || proxies.isEmpty())
  			return null;
  
  		// search id match first
  		if ( serverId != null && !serverId.isEmpty() ) {
  			for (Proxy proxy : proxies) {
  				if ( proxy.isActive() ) {
  					final String proxyId = proxy.getId();
  					if ( proxyId != null && !proxyId.isEmpty() ) {
  						if ( proxyId.equalsIgnoreCase(serverId) ) {
  							if ( ( "http".equalsIgnoreCase( proxy.getProtocol() ) || "https".equalsIgnoreCase( proxy.getProtocol() ) ) ) {
  								if ( matchNonProxy( proxy, host ) )
  									return null;
  								else
  									return proxy;
  							}
  						}
  					}
  				}
  			}
  		}
  
  		// search active proxy
  		for (Proxy proxy : proxies)
  			if ( proxy.isActive() &&
  					( "http".equalsIgnoreCase( proxy.getProtocol() ) || "https".equalsIgnoreCase( proxy.getProtocol() ) )
  					)
  			{
  				if ( matchNonProxy( proxy, host ) )
  					return null;
  				else
  					return proxy;
  			}
  
  		return null;
  	}
docs: Get proxy from settings
  
  @param settings
  @param serverId
  must be non-null and non-empty
  @param host
  hostname
  @return proxy or null if none matching