test/jdk/java/net/Socket/DeadlockTest.java
author aefimov
Wed, 15 May 2019 19:47:28 +0100
changeset 54887 442e22c051f0
parent 54811 9db7c0f561a6
permissions -rw-r--r--
8223798: Replace wildcard address with loopback or local host in tests - part 7 Reviewed-by: dfuchs, vtewari
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
54887
442e22c051f0 8223798: Replace wildcard address with loopback or local host in tests - part 7
aefimov
parents: 54811
diff changeset
     2
 * Copyright (c) 1999, 2019, 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 4176738
54770
62b6e7587b1f 8220673: Add test library support for determining platform IP support
aeubanks
parents: 49431
diff changeset
    27
 * @library /test/lib
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 * @summary Make sure a deadlock situation
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 *     would not occur
49431
5812849b5027 8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents: 47216
diff changeset
    30
 * @run main DeadlockTest
5812849b5027 8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents: 47216
diff changeset
    31
 * @run main/othervm -Djava.net.preferIPv4Stack=true DeadlockTest
2
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.net.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import java.io.*;
54770
62b6e7587b1f 8220673: Add test library support for determining platform IP support
aeubanks
parents: 49431
diff changeset
    36
import jdk.test.lib.net.IPSupport;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
public class DeadlockTest {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
    public static void main(String [] argv) throws Exception {
54811
9db7c0f561a6 8223652: Rename IPSupport.skipIfCurrentConfigurationIsInvalid() to IPSupport.throwSkippedExceptionIfNonOperational()
aeubanks
parents: 54770
diff changeset
    40
        IPSupport.throwSkippedExceptionIfNonOperational();
54770
62b6e7587b1f 8220673: Add test library support for determining platform IP support
aeubanks
parents: 49431
diff changeset
    41
54887
442e22c051f0 8223798: Replace wildcard address with loopback or local host in tests - part 7
aefimov
parents: 54811
diff changeset
    42
        ServerSocket ss = new ServerSocket(0, 0, InetAddress.getLoopbackAddress());
6115
7c523cf2bc8a 6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents: 5506
diff changeset
    43
        Socket clientSocket = new Socket();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
6115
7c523cf2bc8a 6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents: 5506
diff changeset
    45
        try {
7c523cf2bc8a 6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents: 5506
diff changeset
    46
            // Start the server thread
7c523cf2bc8a 6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents: 5506
diff changeset
    47
            Thread s1 = new Thread(new ServerThread(ss));
7c523cf2bc8a 6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents: 5506
diff changeset
    48
            s1.start();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
6115
7c523cf2bc8a 6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents: 5506
diff changeset
    50
            // Start the client thread
7c523cf2bc8a 6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents: 5506
diff changeset
    51
            ClientThread ct = new ClientThread(clientSocket, ss.getLocalPort());
7c523cf2bc8a 6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents: 5506
diff changeset
    52
            Thread c1 = new Thread(ct);
7c523cf2bc8a 6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents: 5506
diff changeset
    53
            c1.start();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
6115
7c523cf2bc8a 6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents: 5506
diff changeset
    55
            // Wait for the client thread to finish
7c523cf2bc8a 6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents: 5506
diff changeset
    56
            c1.join(20000);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
6115
7c523cf2bc8a 6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents: 5506
diff changeset
    58
            // If timeout, we assume there is a deadlock
7c523cf2bc8a 6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents: 5506
diff changeset
    59
            if (c1.isAlive() == true) {
7c523cf2bc8a 6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents: 5506
diff changeset
    60
                // Close the socket to force the server thread
7c523cf2bc8a 6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents: 5506
diff changeset
    61
                // terminate too
7c523cf2bc8a 6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents: 5506
diff changeset
    62
                s1.stop();
7c523cf2bc8a 6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents: 5506
diff changeset
    63
                throw new Exception("Takes too long. Dead lock");
7c523cf2bc8a 6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents: 5506
diff changeset
    64
            }
7c523cf2bc8a 6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents: 5506
diff changeset
    65
        } finally {
7c523cf2bc8a 6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents: 5506
diff changeset
    66
            ss.close();
7c523cf2bc8a 6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents: 5506
diff changeset
    67
            clientSocket.close();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
class ServerThread implements Runnable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    private static boolean dbg = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    ObjectInputStream  in;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    ObjectOutputStream out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    ServerSocket server;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    Socket sock;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
6115
7c523cf2bc8a 6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents: 5506
diff changeset
    83
    public ServerThread(ServerSocket serverSocket) throws Exception {
7c523cf2bc8a 6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents: 5506
diff changeset
    84
        this.server = serverSocket;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    public void ping(int cnt) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
       Message.write(out, new PingMessage(cnt));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    private int cnt = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    public void run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
            if (Thread.currentThread().getName().startsWith("child") == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
                sock  = server.accept();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
                new Thread(this, "child").start();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
                out = new ObjectOutputStream(sock.getOutputStream());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
                out.flush();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
                if (dbg) System.out.println("*** ping0 ***");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
                ping(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
                if (dbg) System.out.println("*** ping1 ***");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
                ping(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
                if (dbg) System.out.println("*** ping2 ***");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
                ping(2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
                if (dbg) System.out.println("*** ping3 ***");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
                ping(3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
                if (dbg) System.out.println("*** ping4 ***");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
                ping(4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
                if (dbg) System.out.println("*** end ***");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        } catch (Throwable e) {
6115
7c523cf2bc8a 6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents: 5506
diff changeset
   118
            System.out.println(e);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
            // If anything goes wrong, just quit.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        if (Thread.currentThread().getName().startsWith("child")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
                in  = new ObjectInputStream(sock.getInputStream());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
                while (true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
                    if (dbg) System.out.println("read " + cnt);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
                    Message msg = (Message) in.readObject();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
                    if (dbg) System.out.println("read done " + cnt++);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
                    switch (msg.code) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
                    case Message.PING: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
                        if (true) System.out.println("ping recv'ed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
                    } break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
            } catch (Throwable e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
                // If anything goes wrong, just quit.       }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
class ClientThread implements Runnable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    ObjectInputStream  in;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    ObjectOutputStream out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    Socket sock;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
6115
7c523cf2bc8a 6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents: 5506
diff changeset
   153
    public ClientThread(Socket sock, int serverPort) throws Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        try {
6115
7c523cf2bc8a 6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents: 5506
diff changeset
   155
            System.out.println("About to connect the client socket");
7c523cf2bc8a 6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents: 5506
diff changeset
   156
            this.sock = sock;
54887
442e22c051f0 8223798: Replace wildcard address with loopback or local host in tests - part 7
aefimov
parents: 54811
diff changeset
   157
            this.sock.connect(new InetSocketAddress(InetAddress.getLoopbackAddress(), serverPort));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
            System.out.println("connected");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
            out = new ObjectOutputStream(sock.getOutputStream());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
            out.flush();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
        } catch (Throwable e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
          System.out.println("client failed with: " + e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
          e.printStackTrace();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
          throw new Exception("Unexpected exception");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    private int cnt = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    public void run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
          in  = new ObjectInputStream(sock.getInputStream());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
          int count = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
          while (true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
              System.out.println("read " + cnt);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
              Message msg = (Message) in.readObject();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
              System.out.println("read done " + cnt++);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
              switch (msg.code) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
              case Message.PING: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
                  System.out.println("ping recv'ed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
                  count++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
              } break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
              }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
              if (count == 5) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
                  sock.close();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
                  break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
              }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
          }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
        }  catch (IOException ioe) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        } catch (Throwable e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
            // If anything went wrong, just quit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
class Message implements java.io.Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    static final int UNKNOWN = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    static final int PING = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    protected int code;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    public Message() { this.code = UNKNOWN; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    public Message(int code) { this.code = code; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    private static int cnt = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    public static void write(ObjectOutput out, Message msg) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
            System.out.println("write message " + cnt);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
            out.writeObject(msg);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
            System.out.println("flush message");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
            out.flush();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
            System.out.println("write message done " + cnt++);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
        } catch (IOException ioe) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
            // Ignore the exception
6115
7c523cf2bc8a 6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents: 5506
diff changeset
   222
            System.out.println(ioe);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
class PingMessage extends Message implements java.io.Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
      public PingMessage() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
          code = Message.PING;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
      public PingMessage(int cnt)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
      {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
          code = Message.PING;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
          this.cnt = cnt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
          data = new int[50000];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
      int cnt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
      int[] data;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
}