Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8214516

Specify that SOCKS is not supported by java.net.HttpClient

XMLWordPrintable

    • x86_64
    • os_x

      A DESCRIPTION OF THE PROBLEM :
      Setting a default ProxySelector returning a SOCKS proxy or using HttpClient.Builder.proxy(ProxySelector) doesn’t work when using HttpClient. HTTP proxies are supported but not a SOCKS proxy which is ignored Using Apache HttpClient or java.netUrlConnection works. There is nothing in the javadoc indicating SOCKS is not supported in HttpClient and it is incoherent with previous behavior, including system properties for SOCKS which are also ignored. Quickly browsed a copy of openjdk source and it seems it only allows HTTP proxies.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a ProxySelector returning a SOCKS proxy for protocol Http. Set as default.
      Create a HttpClient and a get connection, it will not use the returned proxy (a http proxy returned will be used).

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      A conncetion using the SOCKS proxy
      ACTUAL -
      A direct connectio bypassing the proxy

      ---------- BEGIN SOURCE ----------
      Not at hand but since travelling but can supply, please send an email
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      None except using 3rd party lib

      FREQUENCY : always


            rjernst Ryan Ernst
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: