jdk/test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java
author ohair
Tue, 25 May 2010 15:58:33 -0700
changeset 5506 202f599c92aa
parent 1629 9d0fa22f9ffe
child 22277 1d3a2cb3552f
permissions -rw-r--r--
6943119: Rebrand source copyright notices Reviewed-by: darcy, weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1629
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1629
diff changeset
     2
 * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
1629
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
     4
 *
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
     7
 * published by the Free Software Foundation.
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
     8
 *
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    13
 * accompanied this code).
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    14
 *
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    18
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1629
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1629
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1629
diff changeset
    21
 * questions.
1629
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    22
 */
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    23
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    24
/**
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    25
 *  @test LocalRMIServerSocketFactoryTest.java
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    26
 *  @bug 6774170
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    27
 *  @summary Connect to a server socket returned by the LocalRMIServerSocketFactory.
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    28
 *
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    29
 *  @author Daniel Fuchs
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    30
 *
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    31
 *  @run compile -XDignore.symbol.file=true -source 1.6 -g LocalRMIServerSocketFactoryTest.java
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    32
 *  @run main LocalRMIServerSocketFactoryTest
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    33
 */
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    34
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    35
import sun.management.jmxremote.LocalRMIServerSocketFactory;
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    36
import java.io.IOException;
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    37
import java.net.InetAddress;
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    38
import java.net.NetworkInterface;
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    39
import java.net.ServerSocket;
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    40
import java.net.Socket;
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    41
import java.util.concurrent.SynchronousQueue;
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    42
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    43
public class LocalRMIServerSocketFactoryTest {
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    44
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    45
    private static final SynchronousQueue<Exception> queue =
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    46
            new SynchronousQueue<Exception>();
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    47
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    48
    static final class Result extends Exception {
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    49
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    50
        private Result() {
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    51
            super("SUCCESS: No exception was thrown");
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    52
        }
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    53
        static final Result SUCCESS = new Result();
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    54
    }
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    55
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    56
    private static void checkError(String message) throws Exception {
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    57
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    58
        // Wait for the server to set the error field.
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    59
        final Exception x = queue.take();
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    60
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    61
        if (x == Result.SUCCESS) {
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    62
            return;
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    63
        }
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    64
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    65
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    66
        // case of 6674166: this is very unlikely to happen, even if
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    67
        //     both 6674166 and 6774170 aren't fixed. If it happens
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    68
        //     however, it might indicate that neither defects are fixed.
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    69
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    70
        if (x instanceof NullPointerException) {
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    71
            throw new Exception(message + " - " +
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    72
                    "Congratulations! it seems you have triggered 6674166. " +
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    73
                    "Neither 6674166 nor 6774170 seem to be fixed: " + x, x);
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    74
        } else if (x instanceof IOException) {
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    75
            throw new Exception(message + " - " +
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    76
                    "Unexpected IOException. Maybe you triggered 6674166? " +
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    77
                    x, x);
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    78
        } else if (x != null) {
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    79
            throw new Exception(message + " - " +
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    80
                    "Ouch, that's bad. " +
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    81
                    "This is a new kind of unexpected exception " +
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    82
                    x, x);
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    83
        }
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    84
    }
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    85
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    86
    public static void main(String[] args) throws Exception {
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    87
        final LocalRMIServerSocketFactory f =
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    88
                new LocalRMIServerSocketFactory();
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    89
        final ServerSocket s = f.createServerSocket(0);
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    90
        final int port = s.getLocalPort();
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    91
        Thread t = new Thread() {
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    92
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    93
            public void run() {
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    94
                while (true) {
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    95
                    Exception error = Result.SUCCESS;
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    96
                    try {
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    97
                        System.err.println("Accepting: ");
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    98
                        final Socket ss = s.accept();
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
    99
                        System.err.println(ss.getInetAddress() + " accepted");
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   100
                    } catch (Exception x) {
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   101
                        x.printStackTrace();
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   102
                        error = x;
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   103
                    } finally {
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   104
                        try {
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   105
                            // wait for the client to get the exception.
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   106
                            queue.put(error);
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   107
                        } catch (Exception x) {
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   108
                            // too bad!
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   109
                            System.err.println("Could't send result to client!");
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   110
                            x.printStackTrace();
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   111
                            return;
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   112
                        }
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   113
                    }
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   114
                }
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   115
            }
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   116
        };
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   117
        t.setDaemon(true);
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   118
        t.start();
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   119
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   120
        System.err.println("new Socket((String)null, port)");
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   121
        final Socket s1 = new Socket((String) null, port);
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   122
        checkError("new Socket((String)null, port)");
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   123
        s1.close();
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   124
        System.err.println("new Socket((String)null, port): PASSED");
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   125
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   126
        System.err.println("new Socket(InetAddress.getByName(null), port)");
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   127
        final Socket s2 = new Socket(InetAddress.getByName(null), port);
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   128
        checkError("new Socket(InetAddress.getByName(null), port)");
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   129
        s2.close();
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   130
        System.err.println("new Socket(InetAddress.getByName(null), port): PASSED");
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   131
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   132
        System.err.println("new Socket(localhost, port)");
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   133
        final Socket s3 = new Socket("localhost", port);
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   134
        checkError("new Socket(localhost, port)");
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   135
        s3.close();
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   136
        System.err.println("new Socket(localhost, port): PASSED");
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   137
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   138
        System.err.println("new Socket(127.0.0.1, port)");
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   139
        final Socket s4 = new Socket("127.0.0.1", port);
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   140
        checkError("new Socket(127.0.0.1, port)");
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   141
        s4.close();
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   142
        System.err.println("new Socket(127.0.0.1, port): PASSED");
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   143
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   144
    }
9d0fa22f9ffe 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null
dfuchs
parents:
diff changeset
   145
}