void (HttpClient.Builder builder, @NotNull StatsProxyInfo info) { Proxy proxy = info.getProxy(); if (proxy.type() == Proxy.Type.HTTP || proxy.type() == Proxy.Type.SOCKS) { SocketAddress proxyAddress = proxy.address(); if (proxyAddress instanceof InetSocketAddress address) { String hostName = address.getHostString(); int port = address.getPort(); builder.proxy(ProxySelector.of(new InetSocketAddress(hostName, port))); StatsProxyInfo.StatsProxyAuthProvider auth = info.getProxyAuth(); if (auth != null) { String login = auth.getProxyLogin(); if (login != null) { // This Implementation require -Djdk.http.auth.tunneling.disabledSchemes="" in vm options // In other cases PasswordAuthentication will be ignored and authentication will fail builder.authenticator(new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(login, Objects.requireNonNullElse(auth.getProxyPassword(), "").toCharArray()); } }); } } } } }