jdk/test/javax/rmi/ssl/SocketFactoryTest.java
author lana
Thu, 26 Dec 2013 12:04:16 -0800
changeset 23010 6dadb192ad81
parent 22969 d5c38e7ba6d0
permissions -rw-r--r--
8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013 Summary: updated files with 2011, 2012 and 2013 years according to the file's last updated date Reviewed-by: tbell, lancea, chegar
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
23010
6dadb192ad81 8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents: 22969
diff changeset
     2
 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
2
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
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * questions.
2
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().
22969
d5c38e7ba6d0 8034000: lack of /othervm option can cause some RMI tests to fail
smarks
parents: 14778
diff changeset
    28
 *          This test does not affect VM global state, so othervm is
d5c38e7ba6d0 8034000: lack of /othervm option can cause some RMI tests to fail
smarks
parents: 14778
diff changeset
    29
 *          not required.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * @author Daniel Fuchs
14778
5947768d173d 8004748: clean up @build tags in RMI tests
smarks
parents: 5506
diff changeset
    31
 *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * @run main SocketFactoryTest
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import java.io.PrintWriter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import java.io.IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import java.io.Serializable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import java.io.ObjectInputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import java.io.ObjectOutputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import java.io.ByteArrayInputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
import java.io.ByteArrayOutputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
import java.util.Map;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
import java.util.HashMap;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
import javax.net.ssl.SSLContext;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
import javax.rmi.ssl.SslRMIClientSocketFactory;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
import javax.rmi.ssl.SslRMIServerSocketFactory;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
public class SocketFactoryTest {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    public static final String[] ciphersuite =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
        new String[] { "SSL_RSA_WITH_NULL_MD5" };
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    public static final String[] protocol =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
        new String[] { "TLSv1" };
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    public static class MySslRMIClientSocketFactory
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
        extends SslRMIClientSocketFactory {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    public static class MySslRMIServerSocketFactory
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
        extends SslRMIServerSocketFactory {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
        public MySslRMIServerSocketFactory() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
            super();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
        public MySslRMIServerSocketFactory(String[] ciphers,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
                                           String[] protocols,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
                                           boolean need) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
            super(ciphers, protocols, need);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        public MySslRMIServerSocketFactory(SSLContext context,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
                                           String[] ciphers,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
                                           String[] protocols,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
                                           boolean need) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
            super(context, ciphers, protocols, need);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    public static Object serializeAndClone(Object o) throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
        System.out.println("Serializing object: " + o);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        final ByteArrayOutputStream obytes =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
            new ByteArrayOutputStream();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        final ObjectOutputStream ostr =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
            new ObjectOutputStream(obytes);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        ostr.writeObject(o);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        ostr.flush();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        System.out.println("Deserializing object");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        final ByteArrayInputStream ibytes =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
            new ByteArrayInputStream(obytes.toByteArray());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        final ObjectInputStream istr =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
            new ObjectInputStream(ibytes);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        return istr.readObject();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    public static void testEquals(Object a, Object b, boolean expected) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        final boolean found = a.equals(b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        if (found != expected)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
            throw new RuntimeException("testEquals failed: objects are " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
                                       ((found)?"equals":"not equals"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
        if (found && a.hashCode()!=b.hashCode())
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
            throw new RuntimeException("testEquals failed: objects are " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
                                       "equals but their hashcode differ");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    public static void main(String[] args) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
            System.out.println("SocketFactoryTest START.");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
            final SSLContext context = SSLContext.getInstance("SSL");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
            context.init(null, null, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
            final SslRMIClientSocketFactory client1 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
                new SslRMIClientSocketFactory();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
            final SslRMIClientSocketFactory client2 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
                new SslRMIClientSocketFactory();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
            final SslRMIClientSocketFactory client11 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
                (SslRMIClientSocketFactory) serializeAndClone(client1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
            final SslRMIClientSocketFactory client21 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
                (SslRMIClientSocketFactory) serializeAndClone(client2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
            final SslRMIServerSocketFactory server1 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
                new SslRMIServerSocketFactory();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
            final SslRMIServerSocketFactory server2 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
                new SslRMIServerSocketFactory(null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
                                              null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
                                              false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
            final SslRMIServerSocketFactory server3 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
                new SslRMIServerSocketFactory(ciphersuite,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
                                              null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
                                              false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
            final SslRMIServerSocketFactory server4 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
                new SslRMIServerSocketFactory(null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
                                              protocol,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
                                              false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
            final SslRMIServerSocketFactory server5 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
                new SslRMIServerSocketFactory(null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
                                              null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
                                              true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
            final SslRMIServerSocketFactory server6 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
                new SslRMIServerSocketFactory(null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
                                              null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
                                              null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
                                              false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
            final SslRMIServerSocketFactory server7 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
                new SslRMIServerSocketFactory(SSLContext.getDefault(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
                                              null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
                                              null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
                                              false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
            final SslRMIServerSocketFactory server8 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
                new SslRMIServerSocketFactory(null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
                                              null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
                                              null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
                                              true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
            final SslRMIServerSocketFactory server9 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
                new SslRMIServerSocketFactory(SSLContext.getDefault(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
                                              null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
                                              null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
                                              true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
            final SslRMIServerSocketFactory server10 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
                new SslRMIServerSocketFactory(context,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
                                              null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
                                              null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
                                              true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
            final MySslRMIClientSocketFactory subclient1 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
                new MySslRMIClientSocketFactory();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
            final MySslRMIClientSocketFactory subclient2 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
                new MySslRMIClientSocketFactory();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
            final MySslRMIServerSocketFactory subserver1 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
                new MySslRMIServerSocketFactory();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
            final MySslRMIServerSocketFactory subserver2 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
                new MySslRMIServerSocketFactory(null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
                                                null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
                                                false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
            final MySslRMIServerSocketFactory subserver3 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
                new MySslRMIServerSocketFactory(ciphersuite,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
                                                null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
                                                false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
            final MySslRMIServerSocketFactory subserver4 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
                new MySslRMIServerSocketFactory(null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
                                                protocol,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
                                                false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
            final MySslRMIServerSocketFactory subserver5 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
                new MySslRMIServerSocketFactory(null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
                                                null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
                                                true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
            final MySslRMIServerSocketFactory subserver6 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
                new MySslRMIServerSocketFactory(null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
                                                ciphersuite,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
                                                null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
                                                false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
            final MySslRMIServerSocketFactory subserver7 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
                new MySslRMIServerSocketFactory(SSLContext.getDefault(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
                                                ciphersuite,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
                                                null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
                                                false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
            final MySslRMIServerSocketFactory subserver8 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
                new MySslRMIServerSocketFactory(context,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
                                                null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
                                                null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
                                                true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
            // clients
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
            System.out.println("testEquals(client1,client1,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
            testEquals(client1,client1,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
            System.out.println("testEquals(client1,client2,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
            testEquals(client1,client2,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
            System.out.println("testEquals(client1,client11,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
            testEquals(client1,client11,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
            System.out.println("testEquals(client1,client21,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
            testEquals(client1,client21,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
            System.out.println("testEquals(client11,client21,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
            testEquals(client11,client21,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
            System.out.println("testEquals(client1,null,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
            testEquals(client1,null,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
            System.out.println("testEquals(client1,server1,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
            testEquals(client1,server1,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
            System.out.println("testEquals(client21,server2,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
            testEquals(client21,server2,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
            System.out.println("testEquals(client1,new Object(),false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
            testEquals(client1,new Object(),false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
            // servers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
            System.out.println("testEquals(server1,server1,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
            testEquals(server1,server1,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
            System.out.println("testEquals(server2,server2,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
            testEquals(server2,server2,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
            System.out.println("testEquals(server3,server3,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
            testEquals(server3,server3,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
            System.out.println("testEquals(server4,server4,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
            testEquals(server4,server4,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
            System.out.println("testEquals(server5,server5,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
            testEquals(server5,server5,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
            System.out.println("testEquals(server1,server2,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
            testEquals(server1,server2,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
            System.out.println("testEquals(server1,server3,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
            testEquals(server1,server3,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
            System.out.println("testEquals(server2,server3,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
            testEquals(server2,server3,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
            System.out.println("testEquals(server3,server4,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
            testEquals(server3,server4,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
            System.out.println("testEquals(server4,server5,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
            testEquals(server4,server5,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
            System.out.println("testEquals(server6,server7,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
            testEquals(server6,server7,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
            System.out.println("testEquals(server8,server9,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
            testEquals(server8,server9,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
            System.out.println("testEquals(server9,server10,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
            testEquals(server9,server10,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
            System.out.println("testEquals(server2,server6,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
            testEquals(server2,server6,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
            System.out.println("testEquals(server2,server7,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
            testEquals(server2,server7,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
            System.out.println("testEquals(server5,server8,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
            testEquals(server5,server8,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
            System.out.println("testEquals(server5,server9,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
            testEquals(server5,server9,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
            System.out.println("testEquals(server1,null,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
            testEquals(server1,null,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
            System.out.println("testEquals(server2,null,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
            testEquals(server2,null,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
            System.out.println("testEquals(server3,null,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
            testEquals(server3,null,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
            System.out.println("testEquals(server1,client2,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
            testEquals(server1,client2,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
            System.out.println("testEquals(server2,client11,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
            testEquals(server2,client11,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
            System.out.println("testEquals(server1,new Object(),false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
            testEquals(server1,new Object(),false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
            // client subclass
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
            System.out.println("testEquals(subclient1,subclient1,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
            testEquals(subclient1,subclient1,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
            System.out.println("testEquals(subclient1,subclient2,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
            testEquals(subclient1,subclient2,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
            System.out.println("testEquals(subclient1,client1,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
            testEquals(subclient1,client1,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
            System.out.println("testEquals(client1,subclient1,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
            testEquals(client1,subclient1,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
            System.out.println("testEquals(subclient1,null,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
            testEquals(subclient1,null,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
            System.out.println("testEquals(subclient1,server1,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
            testEquals(subclient1,server1,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
            System.out.println("testEquals(server1,subclient1,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
            testEquals(server1,subclient1,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
            System.out.println("testEquals(subclient2,subserver2,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
            testEquals(subclient1,subserver2,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
            System.out.println("testEquals(subclient1,new Object(),false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
            testEquals(subclient1,new Object(),false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
            // server subclass
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
            System.out.println("testEquals(subserver1,subserver1,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
            testEquals(subserver1,subserver1,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
            System.out.println("testEquals(subserver2,subserver2,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
            testEquals(subserver2,subserver2,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
            System.out.println("testEquals(subserver3,subserver3,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
            testEquals(subserver3,subserver3,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
            System.out.println("testEquals(subserver4,subserver4,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
            testEquals(subserver4,subserver4,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
            System.out.println("testEquals(subserver5,subserver5,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
            testEquals(subserver5,subserver5,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
            System.out.println("testEquals(subserver1,subserver2,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
            testEquals(subserver1,subserver2,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
            System.out.println("testEquals(subserver1,subserver3,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
            testEquals(subserver1,subserver3,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
            System.out.println("testEquals(subserver2,subserver3,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
            testEquals(subserver2,subserver3,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
            System.out.println("testEquals(subserver3,subserver4,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
            testEquals(subserver3,subserver4,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
            System.out.println("testEquals(subserver4,subserver5,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
            testEquals(subserver4,subserver5,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
            System.out.println("testEquals(subserver3,subserver6,true)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
            testEquals(subserver3,subserver6,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
            System.out.println("testEquals(subserver3,subserver7,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
            testEquals(subserver3,subserver7,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
            System.out.println("testEquals(subserver1,server1,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
            testEquals(subserver1,server1,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
            System.out.println("testEquals(server1,subserver1,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
            testEquals(server1,subserver1,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
            System.out.println("testEquals(subserver2,server2,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
            testEquals(subserver2,server2,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
            System.out.println("testEquals(server2,subserver2,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
            testEquals(server2,subserver2,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
            System.out.println("testEquals(subserver3,server3,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
            testEquals(subserver3,server3,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
            System.out.println("testEquals(server3,subserver3,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
            testEquals(server3,subserver3,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
            System.out.println("testEquals(subserver4,server4,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
            testEquals(subserver4,server4,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
            System.out.println("testEquals(server4,subserver4,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
            testEquals(server4,subserver4,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
            System.out.println("testEquals(subserver5,server5,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
            testEquals(subserver5,server5,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
            System.out.println("testEquals(server5,subserver5,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
            testEquals(server5,subserver5,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
            System.out.println("testEquals(server10,subserver8,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
            testEquals(server10,subserver8,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
            System.out.println("testEquals(subserver8,server10,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
            testEquals(subserver8,server10,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
            System.out.println("testEquals(subserver1,null,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
            testEquals(subserver1,null,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
            System.out.println("testEquals(subserver1,client2,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
            testEquals(subserver1,client2,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
            System.out.println("testEquals(subserver1,subclient2,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
            testEquals(subserver1,subclient2,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
            System.out.println("testEquals(client1,subserver2,false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
            testEquals(client1,subserver2,false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
            System.out.println("testEquals(subserver1,new Object(),false)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
            testEquals(subserver1,new Object(),false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
            System.out.println("SocketFactoryTest PASSED.");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
        } catch (Exception x) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
            System.out.println("SocketFactoryTest FAILED: " + x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
            x.printStackTrace();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
            System.exit(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
}