test/jdk/javax/net/ssl/SSLEngine/LargePacket.java
author erikj
Tue, 12 Sep 2017 19:03:39 +0200
changeset 47216 71c04702a3d5
parent 23052 jdk/test/javax/net/ssl/SSLEngine/LargePacket.java@241885315119
permissions -rw-r--r--
8187443: Forest Consolidation: Move files to unified layout Reviewed-by: darcy, ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
14194
971f46db533d 7068321: Support TLS Server Name Indication (SNI) Extension in JSSE Server
xuelei
parents: 10917
diff changeset
     2
 * Copyright (c) 2006, 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
14194
971f46db533d 7068321: Support TLS Server Name Indication (SNI) Extension in JSSE Server
xuelei
parents: 10917
diff changeset
    24
//
971f46db533d 7068321: Support TLS Server Name Indication (SNI) Extension in JSSE Server
xuelei
parents: 10917
diff changeset
    25
// SunJSSE does not support dynamic system properties, no way to re-use
971f46db533d 7068321: Support TLS Server Name Indication (SNI) Extension in JSSE Server
xuelei
parents: 10917
diff changeset
    26
// system properties in samevm/agentvm mode.
971f46db533d 7068321: Support TLS Server Name Indication (SNI) Extension in JSSE Server
xuelei
parents: 10917
diff changeset
    27
//
971f46db533d 7068321: Support TLS Server Name Indication (SNI) Extension in JSSE Server
xuelei
parents: 10917
diff changeset
    28
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * @test
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * @bug 6388456
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * @summary Need adjustable TLS max record size for interoperability
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 *      with non-compliant
14194
971f46db533d 7068321: Support TLS Server Name Indication (SNI) Extension in JSSE Server
xuelei
parents: 10917
diff changeset
    35
 * @run main/othervm LargePacket
10915
1e20964cebf3 7064341: jsse/runtime security problem
xuelei
parents: 5506
diff changeset
    36
 *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * @author Xuelei Fan
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import javax.net.ssl.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
import java.nio.channels.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
import java.net.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
public class LargePacket extends SSLEngineService {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
     * =============================================================
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
     * Set the various variables needed for the tests, then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
     * specify what tests to run on each side.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
     * Should we run the client or server in a separate thread?
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
     * Both sides can throw exceptions, but do you have a preference
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     * as to which side should be the main thread.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    static boolean separateServerThread = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    // Is the server ready to serve?
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    volatile static boolean serverReady = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * Turn on SSL debugging?
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    static boolean debug = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * Define the server side of the test.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * If the server prematurely exits, serverReady will be set to true
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * to avoid infinite hangs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    void doServerSide() throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        // create SSLEngine.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
        SSLEngine ssle = createSSLEngine(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
        // Create a server socket channel.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        InetSocketAddress isa =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
                new InetSocketAddress(InetAddress.getLocalHost(), serverPort);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        ServerSocketChannel ssc = ServerSocketChannel.open();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        ssc.socket().bind(isa);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        serverPort = ssc.socket().getLocalPort();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        // Signal Client, we're ready for his connect.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        serverReady = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        // Accept a socket channel.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        SocketChannel sc = ssc.accept();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        // Complete connection.
14194
971f46db533d 7068321: Support TLS Server Name Indication (SNI) Extension in JSSE Server
xuelei
parents: 10917
diff changeset
    91
        while (!sc.finishConnect()) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
            // waiting for the connection completed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        // handshaking
14194
971f46db533d 7068321: Support TLS Server Name Indication (SNI) Extension in JSSE Server
xuelei
parents: 10917
diff changeset
    96
        handshaking(ssle, sc, null);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        // receive application data
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        receive(ssle, sc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        // send out application data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        deliver(ssle, sc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        // close the socket channel.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        sc.close();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        ssc.close();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * Define the client side of the test.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * If the server prematurely exits, serverReady will be set to true
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * to avoid infinite hangs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    void doClientSide() throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        // create SSLEngine.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        SSLEngine ssle = createSSLEngine(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
         * Wait for server to get started.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        while (!serverReady) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
            Thread.sleep(50);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        // Create a non-blocking socket channel.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        SocketChannel sc = SocketChannel.open();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        sc.configureBlocking(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
        InetSocketAddress isa =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
                new InetSocketAddress(InetAddress.getLocalHost(), serverPort);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
        sc.connect(isa);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        // Complete connection.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        while (!sc.finishConnect() ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
            // waiting for the connection completed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        // handshaking
14194
971f46db533d 7068321: Support TLS Server Name Indication (SNI) Extension in JSSE Server
xuelei
parents: 10917
diff changeset
   139
        handshaking(ssle, sc, null);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        // send out application data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        deliver(ssle, sc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        // receive application data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        receive(ssle, sc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
        // close the socket channel.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        sc.close();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     * =============================================================
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * The remainder is just support stuff
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    volatile Exception serverException = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    volatile Exception clientException = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    // use any free port by default
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    volatile int serverPort = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    public static void main(String args[]) throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
        if (debug)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
            System.setProperty("javax.net.debug", "all");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        new LargePacket();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    Thread clientThread = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    Thread serverThread = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * Primary constructor, used to drive remainder of the test.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * Fork off the other side, then do your work.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
    LargePacket() throws Exception {
23052
241885315119 8032473: Restructure JSSE regression test hierarchy in jdk test
xuelei
parents: 14194
diff changeset
   177
        super("../etc");
14194
971f46db533d 7068321: Support TLS Server Name Indication (SNI) Extension in JSSE Server
xuelei
parents: 10917
diff changeset
   178
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        if (separateServerThread) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
            startServer(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
            startClient(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
            startClient(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
            startServer(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
         * Wait for other side to close down.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        if (separateServerThread) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
            serverThread.join();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
            clientThread.join();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
         * When we get here, the test is pretty much over.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
         * If the main thread excepted, that propagates back
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
         * immediately.  If the other thread threw an exception, we
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
         * should report back.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        if (serverException != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
            System.out.print("Server Exception:");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
            throw serverException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        if (clientException != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
            System.out.print("Client Exception:");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
            throw clientException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    void startServer(boolean newThread) throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        if (newThread) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
            serverThread = new Thread() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
                public void run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
                    try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
                        doServerSide();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
                    } catch (Exception e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
                        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
                         * Our server thread just died.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
                         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
                         * Release the client, if not active already...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
                         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
                        System.err.println("Server died...");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
                        System.err.println(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
                        serverReady = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
                        serverException = e;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
            };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
            serverThread.start();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
            doServerSide();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    void startClient(boolean newThread) throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
        if (newThread) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
            clientThread = new Thread() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
                public void run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
                    try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
                        doClientSide();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
                    } catch (Exception e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
                        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
                         * Our client thread just died.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
                         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
                        System.err.println("Client died...");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
                        clientException = e;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
            };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
            clientThread.start();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
            doClientSide();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
}