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

Socket.connect specified to throw UHE for unresolved address is problematic for SOCKS V5 proxy

XMLWordPrintable

    • b03
    • generic
    • generic

        A DESCRIPTION OF THE PROBLEM :
        As the title says, Socket::connect is not specified to throw UnknownHostException when called with an unresolved address.

        This is a problem when the Socket was created with a SOCKS proxy (V5 SOCKS supports the passing of an unresolved address (e.g. an Tor .onion address) to the SOCKS server for resolution).


        REGRESSION : Last worked in version 17

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Create a Socket with a SOCKS proxy and address to connect to an unresolved address

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        It works as before
        ACTUAL -
        An UnknownHost exception is thrown

        ---------- BEGIN SOURCE ----------
        Proxy proxy = new Proxy( Proxy.Type.SOCKS, new InetSocketAddress( "127.0.0.1", 1234 ));

        InetSocketAddress address = InetSocketAddress.createUnresolved( "www.google.com", 443 );

        Socket socket = new Socket( proxy );

        socket.connect( address );
        ---------- END SOURCE ----------

        FREQUENCY : always


              vyazici Volkan Yazici
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: