code: private void findDefaultProxy() {
          ProxySearch proxySearch = new ProxySearch();
          proxySearch.addStrategy(ProxySearch.Strategy.JAVA);
          proxySearch.addStrategy(ProxySearch.Strategy.ENV_VAR);
          proxySearch.addStrategy(ProxySearch.Strategy.OS_DEFAULT);
          proxySearch.addStrategy(ProxySearch.Strategy.BROWSER);
          ProxySelector proxySelector = proxySearch.getProxySelector();
  
          if (proxySelector != null) {
              ProxySelector.setDefault(proxySelector);
              try {
                  List<Proxy> proxyList = proxySelector.select(new URI(serviceUrl));
                  if (proxyList != null && !proxyList.isEmpty()) {
                      for (Proxy proxy : proxyList) {
                          InetSocketAddress address = (InetSocketAddress) proxy.address();
                          if (address != null) {
                              String host = address.getHostName();
                              int port = address.getPort();
                              String username = System.getProperty(HTTP_PROXY_USER);
                              String password = System.getProperty(HTTP_PROXY_PASSWORD);
                              setProxy(host, port, username, password);
                          }
                      }
                  }
              } catch (URISyntaxException e) {
                  logger.error("Bad service url: " + serviceUrl, e);
              }
          }
      }
docs: /* --- Private methods ---