public ProvidedProxyConfig(@Nonnull final Map<Scheme, Host> proxyHostMap, @Nonnull final Map<Scheme, List<String>> nonProxyHosts) { Preconditions.checkNotNull(proxyHostMap); Preconditions.checkNotNull(nonProxyHosts); this.proxyHostMap = new HashMap<>(proxyHostMap.size()); for (Scheme s : proxyHostMap.keySet()) { Host h = proxyHostMap.get(s); this.proxyHostMap.put(s.schemeName(), new HttpHost(h.getHost(), h.getPort())); } this.nonProxyHosts = new HashMap<>(nonProxyHosts.size()); for (Scheme scheme : nonProxyHosts.keySet()) { List<String> nonProxyHostList = nonProxyHosts.get(scheme); if (nonProxyHostList != null) { Pattern wildcardHostsPattern = getWildcardHostsPattern(nonProxyHostList); Set<String> literalHosts = getLiteralHosts(nonProxyHostList); this.nonProxyHosts.put(scheme.schemeName(), host -> literalHosts.contains(host) || wildcardHostsPattern != null && wildcardHostsPattern.matcher(host).matches()); } } }