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

ServerSocket(Proxy) accepts HTTP proxy

XMLWordPrintable

    • tiger
    • generic
    • generic

      Name: akR10050 Date: 09/11/2003


      Spec for ServerSocket(Proxy) specifies IllegalArgumentException to be thrown if
      the specified proxy is of an incompatible type. RI throws nothing.

      Here is the testcase:
      --------------------- Test30.java -----------------------
      import java.net.ServerSocket;
      import java.net.Proxy;
      import java.net.InetSocketAddress;

      public class Test30 {
          public static void main(String[] args) {
              Proxy p = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(0));
              try {
                  new ServerSocket(p);
              } catch (IllegalArgumentException iae) {
                  System.err.println("CORRECT: " + iae);
              }
              System.err.println("WRONG: HTTP proxy is not a compatible type for"
                      + " socket");
          }
      }
      --------------------- Test30.java -----------------------

      Output:

      $ java Test29
      WRONG: HTTP proxy is not a compatible type for socket
      $ java -version
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b18)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b18, mixed mode)


      ======================================================================

            jccollet Jean-Christophe Collet (Inactive)
            kaisunw Kai Kai (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: