jdk/test/javax/rmi/ssl/SocketFactoryTest.java
author duke
Wed, 05 Jul 2017 16:38:40 +0200
changeset 782 f2e6591ff695
parent 2 90ce3da70b43
child 5506 202f599c92aa
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 2003-2007 Sun Microsystems, Inc.  All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
 * @test
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
 * @bug 4932837 6582235
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 * @summary Test SslRMI[Client|Server]SocketFactory equals() and hashCode().
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 * @author Daniel Fuchs
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 * @run clean SocketFactoryTest
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * @run build SocketFactoryTest
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * @run main SocketFactoryTest
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.io.PrintWriter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import java.io.IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import java.io.Serializable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import java.io.ObjectInputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import java.io.ObjectOutputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import java.io.ByteArrayInputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import java.io.ByteArrayOutputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
import java.util.Map;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
import java.util.HashMap;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
import javax.net.ssl.SSLContext;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
import javax.rmi.ssl.SslRMIClientSocketFactory;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
import javax.rmi.ssl.SslRMIServerSocketFactory;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
public class SocketFactoryTest {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    public static final String[] ciphersuite =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
        new String[] { "SSL_RSA_WITH_NULL_MD5" };
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    public static final String[] protocol =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
        new String[] { "TLSv1" };
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    public static class MySslRMIClientSocketFactory
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
        extends SslRMIClientSocketFactory {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    public static class MySslRMIServerSocketFactory
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
        extends SslRMIServerSocketFactory {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
        public MySslRMIServerSocketFactory() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
            super();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
        public MySslRMIServerSocketFactory(String[] ciphers,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
                                           String[] protocols,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
                                           boolean need) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
            super(ciphers, protocols, need);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
        public MySslRMIServerSocketFactory(SSLContext context,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
                                           String[] ciphers,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
                                           String[] protocols,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
                                           boolean need) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
            super(context, ciphers, protocols, need);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    public static Object serializeAndClone(Object o) throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        System.out.println("Serializing object: " + o);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
        final ByteArrayOutputStream obytes =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
            new ByteArrayOutputStream();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        final ObjectOutputStream ostr =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
            new ObjectOutputStream(obytes);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        ostr.writeObject(o);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        ostr.flush();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        System.out.println("Deserializing object");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        final ByteArrayInputStream ibytes =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
            new ByteArrayInputStream(obytes.toByteArray());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        final ObjectInputStream istr =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
            new ObjectInputStream(ibytes);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        return istr.readObject();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    public static void testEquals(Object a, Object b, boolean expected) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        final boolean found = a.equals(b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        if (found != expected)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
            throw new RuntimeException("testEquals failed: objects are " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
                                       ((found)?"equals":"not equals"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        if (found && a.hashCode()!=b.hashCode())
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
            throw new RuntimeException("testEquals failed: objects are " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
                                       "equals but their hashcode differ");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    public static void main(String[] args) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
            System.out.println("SocketFactoryTest START.");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
            final SSLContext context = SSLContext.getInstance("SSL");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
            context.init(null, null, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
            final SslRMIClientSocketFactory client1 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
                new SslRMIClientSocketFactory();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
            final SslRMIClientSocketFactory client2 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
                new SslRMIClientSocketFactory();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
            final SslRMIClientSocketFactory client11 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
                (SslRMIClientSocketFactory) serializeAndClone(client1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
            final SslRMIClientSocketFactory client21 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
                (SslRMIClientSocketFactory) serializeAndClone(client2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
            final SslRMIServerSocketFactory server1 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
                new SslRMIServerSocketFactory();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
            final SslRMIServerSocketFactory server2 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
                new SslRMIServerSocketFactory(null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
                                              null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
                                              false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
            final SslRMIServerSocketFactory server3 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
                new SslRMIServerSocketFactory(ciphersuite,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
                                              null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
                                              false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
            final SslRMIServerSocketFactory server4 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
                new SslRMIServerSocketFactory(null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
                                              protocol,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
                                              false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
            final SslRMIServerSocketFactory server5 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
                new SslRMIServerSocketFactory(null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
                                              null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
                                              true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
            final SslRMIServerSocketFactory server6 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
                new SslRMIServerSocketFactory(null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
                                              null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
                                              null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
                                              false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
            final SslRMIServerSocketFactory server7 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
                new SslRMIServerSocketFactory(SSLContext.getDefault(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
                                              null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
                                              null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
                                              false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
            final SslRMIServerSocketFactory server8 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
                new SslRMIServerSocketFactory(null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
                                              null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
                                              null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
                                              true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
            final SslRMIServerSocketFactory server9 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
                new SslRMIServerSocketFactory(SSLContext.getDefault(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
                                              null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
                                              null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
                                              true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
            final SslRMIServerSocketFactory server10 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                new SslRMIServerSocketFactory(context,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
                                              null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
                                              null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
                                              true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
            final MySslRMIClientSocketFactory subclient1 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
                new MySslRMIClientSocketFactory();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
            final MySslRMIClientSocketFactory subclient2 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
                new MySslRMIClientSocketFactory();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
            final MySslRMIServerSocketFactory subserver1 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
                new MySslRMIServerSocketFactory();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
            final MySslRMIServerSocketFactory subserver2 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
                new MySslRMIServerSocketFactory(null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
                                                null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
                                                false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
            final MySslRMIServerSocketFactory subserver3 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
                new MySslRMIServerSocketFactory(ciphersuite,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
                                                null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
                                                false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
            final MySslRMIServerSocketFactory subserver4 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
                new MySslRMIServerSocketFactory(null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
                                                protocol,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
                                                false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
            final MySslRMIServerSocketFactory subserver5 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
                new MySslRMIServerSocketFactory(null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
                                                null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
                                                true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
            final MySslRMIServerSocketFactory subserver6 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
                new MySslRMIServerSocketFactory(null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
                                                ciphersuite,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
                                                null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
                                                false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
            final MySslRMIServerSocketFactory subserver7 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
                new MySslRMIServerSocketFactory(SSLContext.getDefault(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
                                                ciphersuite,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
                                                null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
                                                false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
            final MySslRMIServerSocketFactory subserver8 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
                new MySslRMIServerSocketFactory(context,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
                                                null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
                                                null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
                                                true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
            // clients
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
            System.out.println("testEquals(client1,client1,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
            testEquals(client1,client1,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
            System.out.println("testEquals(client1,client2,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
            testEquals(client1,client2,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
            System.out.println("testEquals(client1,client11,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
            testEquals(client1,client11,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
            System.out.println("testEquals(client1,client21,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
            testEquals(client1,client21,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
            System.out.println("testEquals(client11,client21,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
            testEquals(client11,client21,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
            System.out.println("testEquals(client1,null,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
            testEquals(client1,null,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
            System.out.println("testEquals(client1,server1,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
            testEquals(client1,server1,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
            System.out.println("testEquals(client21,server2,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
            testEquals(client21,server2,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
            System.out.println("testEquals(client1,new Object(),false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
            testEquals(client1,new Object(),false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
            // servers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
            System.out.println("testEquals(server1,server1,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
            testEquals(server1,server1,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
            System.out.println("testEquals(server2,server2,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
            testEquals(server2,server2,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
            System.out.println("testEquals(server3,server3,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
            testEquals(server3,server3,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
            System.out.println("testEquals(server4,server4,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
            testEquals(server4,server4,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
            System.out.println("testEquals(server5,server5,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
            testEquals(server5,server5,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
            System.out.println("testEquals(server1,server2,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
            testEquals(server1,server2,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
            System.out.println("testEquals(server1,server3,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
            testEquals(server1,server3,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
            System.out.println("testEquals(server2,server3,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
            testEquals(server2,server3,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
            System.out.println("testEquals(server3,server4,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
            testEquals(server3,server4,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
            System.out.println("testEquals(server4,server5,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
            testEquals(server4,server5,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
            System.out.println("testEquals(server6,server7,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
            testEquals(server6,server7,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
            System.out.println("testEquals(server8,server9,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
            testEquals(server8,server9,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
            System.out.println("testEquals(server9,server10,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
            testEquals(server9,server10,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
            System.out.println("testEquals(server2,server6,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
            testEquals(server2,server6,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
            System.out.println("testEquals(server2,server7,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
            testEquals(server2,server7,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
            System.out.println("testEquals(server5,server8,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
            testEquals(server5,server8,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
            System.out.println("testEquals(server5,server9,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
            testEquals(server5,server9,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
            System.out.println("testEquals(server1,null,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
            testEquals(server1,null,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
            System.out.println("testEquals(server2,null,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
            testEquals(server2,null,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
            System.out.println("testEquals(server3,null,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
            testEquals(server3,null,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
            System.out.println("testEquals(server1,client2,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
            testEquals(server1,client2,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
            System.out.println("testEquals(server2,client11,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
            testEquals(server2,client11,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
            System.out.println("testEquals(server1,new Object(),false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
            testEquals(server1,new Object(),false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
            // client subclass
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
            System.out.println("testEquals(subclient1,subclient1,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
            testEquals(subclient1,subclient1,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
            System.out.println("testEquals(subclient1,subclient2,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
            testEquals(subclient1,subclient2,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
            System.out.println("testEquals(subclient1,client1,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
            testEquals(subclient1,client1,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
            System.out.println("testEquals(client1,subclient1,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
            testEquals(client1,subclient1,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
            System.out.println("testEquals(subclient1,null,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
            testEquals(subclient1,null,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
            System.out.println("testEquals(subclient1,server1,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
            testEquals(subclient1,server1,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
            System.out.println("testEquals(server1,subclient1,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
            testEquals(server1,subclient1,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
            System.out.println("testEquals(subclient2,subserver2,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
            testEquals(subclient1,subserver2,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
            System.out.println("testEquals(subclient1,new Object(),false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
            testEquals(subclient1,new Object(),false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
            // server subclass
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
            System.out.println("testEquals(subserver1,subserver1,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
            testEquals(subserver1,subserver1,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
            System.out.println("testEquals(subserver2,subserver2,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
            testEquals(subserver2,subserver2,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
            System.out.println("testEquals(subserver3,subserver3,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
            testEquals(subserver3,subserver3,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
            System.out.println("testEquals(subserver4,subserver4,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
            testEquals(subserver4,subserver4,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
            System.out.println("testEquals(subserver5,subserver5,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
            testEquals(subserver5,subserver5,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
            System.out.println("testEquals(subserver1,subserver2,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
            testEquals(subserver1,subserver2,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
            System.out.println("testEquals(subserver1,subserver3,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
            testEquals(subserver1,subserver3,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
            System.out.println("testEquals(subserver2,subserver3,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
            testEquals(subserver2,subserver3,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
            System.out.println("testEquals(subserver3,subserver4,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
            testEquals(subserver3,subserver4,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
            System.out.println("testEquals(subserver4,subserver5,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
            testEquals(subserver4,subserver5,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
            System.out.println("testEquals(subserver3,subserver6,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
            testEquals(subserver3,subserver6,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
            System.out.println("testEquals(subserver3,subserver7,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
            testEquals(subserver3,subserver7,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
            System.out.println("testEquals(subserver1,server1,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
            testEquals(subserver1,server1,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
            System.out.println("testEquals(server1,subserver1,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
            testEquals(server1,subserver1,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
            System.out.println("testEquals(subserver2,server2,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
            testEquals(subserver2,server2,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
            System.out.println("testEquals(server2,subserver2,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
            testEquals(server2,subserver2,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
            System.out.println("testEquals(subserver3,server3,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
            testEquals(subserver3,server3,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
            System.out.println("testEquals(server3,subserver3,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
            testEquals(server3,subserver3,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
            System.out.println("testEquals(subserver4,server4,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
            testEquals(subserver4,server4,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
            System.out.println("testEquals(server4,subserver4,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
            testEquals(server4,subserver4,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
            System.out.println("testEquals(subserver5,server5,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
            testEquals(subserver5,server5,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
            System.out.println("testEquals(server5,subserver5,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
            testEquals(server5,subserver5,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
            System.out.println("testEquals(server10,subserver8,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
            testEquals(server10,subserver8,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
            System.out.println("testEquals(subserver8,server10,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
            testEquals(subserver8,server10,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
            System.out.println("testEquals(subserver1,null,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
            testEquals(subserver1,null,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
            System.out.println("testEquals(subserver1,client2,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
            testEquals(subserver1,client2,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
            System.out.println("testEquals(subserver1,subclient2,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
            testEquals(subserver1,subclient2,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
            System.out.println("testEquals(client1,subserver2,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
            testEquals(client1,subserver2,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
            System.out.println("testEquals(subserver1,new Object(),false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
            testEquals(subserver1,new Object(),false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
            System.out.println("SocketFactoryTest PASSED.");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
        } catch (Exception x) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
            System.out.println("SocketFactoryTest FAILED: " + x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
            x.printStackTrace();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
            System.exit(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
}