@Nullable
  public Proxy getProxy(final String url) {
    try {
      final java.net.ProxySelector systemSelector = java.net.ProxySelector.getDefault();
      if (systemSelector == null) {
        return null;
      }
      final URI uri = new URI(url).parseServerAuthority();
      final List<java.net.Proxy> selected = systemSelector.select(uri);
      if (selected == null || selected.isEmpty()) {
        return null;
      }
      for (java.net.Proxy proxy : selected) {
        if (proxy.type() == java.net.Proxy.Type.HTTP && isValid(proxy.address())) {
          final String proxyType = chooseProxyType(uri.getScheme());
          if (proxyType != null) {
            final InetSocketAddress addr = (InetSocketAddress)proxy.address();
            return new Proxy(proxyType, addr.getHostString(), addr.getPort(), JreProxyAuthentication.INSTANCE);
          }
        }
      }
    }
    catch (Throwable e) {
      // URL invalid or not accepted by selector or no selector at all, simply use no proxy
    }
    return null;
  }
@Nullable
  public Proxy getProxy(final String url)