JDK HttpClient doesn't support socks proxies, only HTTP(S) proxies, even though types like java.net.Proxy.Type.SOCKS do exist. This problem isn't documented at all in the Java JDK, which causes Java to silently disregard the socks proxy when you try to use it, by using a non-proxy connection.
This problem is reported as a bug in 2018 to OpenJDK, but hasn't been fixed yet: https://bugs.openjdk.java.net/browse/JDK-8214516