author | jboes |
Fri, 08 Nov 2019 11:15:16 +0000 | |
changeset 59029 | 3786a0962570 |
parent 54811 | 9db7c0f561a6 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
49431
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5506 | 19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
2 | 22 |
*/ |
23 |
||
24 |
/** |
|
25 |
* @test |
|
26 |
* @bug 4163126 |
|
54770
62b6e7587b1f
8220673: Add test library support for determining platform IP support
aeubanks
parents:
49431
diff
changeset
|
27 |
* @library /test/lib |
2 | 28 |
* @summary test to see if timeout hangs |
29 |
* @run main/timeout=15 Timeout |
|
49431
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
47216
diff
changeset
|
30 |
* @run main/othervm/timeout=15 -Djava.net.preferIPv4Stack=true Timeout |
2 | 31 |
*/ |
32 |
import java.net.*; |
|
33 |
import java.io.*; |
|
54770
62b6e7587b1f
8220673: Add test library support for determining platform IP support
aeubanks
parents:
49431
diff
changeset
|
34 |
import jdk.test.lib.net.IPSupport; |
2 | 35 |
|
36 |
public class Timeout { |
|
37 |
public static void main(String[] args) throws Exception { |
|
54811
9db7c0f561a6
8223652: Rename IPSupport.skipIfCurrentConfigurationIsInvalid() to IPSupport.throwSkippedExceptionIfNonOperational()
aeubanks
parents:
54770
diff
changeset
|
38 |
IPSupport.throwSkippedExceptionIfNonOperational(); |
54770
62b6e7587b1f
8220673: Add test library support for determining platform IP support
aeubanks
parents:
49431
diff
changeset
|
39 |
|
2 | 40 |
boolean success = false; |
6115
7c523cf2bc8a
6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents:
5506
diff
changeset
|
41 |
ServerSocket sock = new ServerSocket(0); |
2 | 42 |
try { |
43 |
sock.setSoTimeout(2); |
|
44 |
sock.accept(); |
|
45 |
} catch (InterruptedIOException e) { |
|
46 |
success = true; |
|
6115
7c523cf2bc8a
6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents:
5506
diff
changeset
|
47 |
} finally { |
7c523cf2bc8a
6969395: TEST_BUG: Tests in java/net sun/net problems
chegar
parents:
5506
diff
changeset
|
48 |
sock.close(); |
2 | 49 |
} |
50 |
if (!success) |
|
51 |
throw new RuntimeException("Socket timeout failure."); |
|
52 |
} |
|
53 |
} |