Skip to content

Commit

Permalink
Backport 8aae88b0fc4acb76ef140f120712403cf4b04a46
Browse files Browse the repository at this point in the history
  • Loading branch information
duke committed Sep 6, 2024
1 parent 58cbf5d commit a8ab70a
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions test/jdk/java/nio/channels/SocketChannel/AdaptorStreams.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -158,7 +158,7 @@ public void testTimedRead1() throws Exception {
withConnection((sc, peer) -> {
peer.getOutputStream().write(99);
Socket s = sc.socket();
s.setSoTimeout(1000);
s.setSoTimeout(60_000);
int n = s.getInputStream().read();
assertEquals(n, 99);
});
Expand All @@ -171,7 +171,7 @@ public void testTimedRead2() throws Exception {
withConnection((sc, peer) -> {
scheduleWrite(peer.getOutputStream(), 99, 1000);
Socket s = sc.socket();
s.setSoTimeout(5000);
s.setSoTimeout(60_000);
int n = s.getInputStream().read();
assertEquals(n, 99);
});
Expand All @@ -183,7 +183,7 @@ public void testTimedRead2() throws Exception {
public void testTimedRead3() throws Exception {
withConnection((sc, peer) -> {
Socket s = sc.socket();
s.setSoTimeout(1000);
s.setSoTimeout(500);
InputStream in = s.getInputStream();
expectThrows(SocketTimeoutException.class, () -> in.read());
});
Expand All @@ -196,7 +196,7 @@ public void testTimedRead4() throws Exception {
withConnection((sc, peer) -> {
scheduleClose(sc, 2000);
Socket s = sc.socket();
s.setSoTimeout(60*1000);
s.setSoTimeout(60_000);
InputStream in = s.getInputStream();
expectThrows(IOException.class, () -> in.read());
});
Expand All @@ -210,7 +210,7 @@ public void testTimedRead5() throws Exception {
Socket s = sc.socket();
Thread.currentThread().interrupt();
try {
s.setSoTimeout(60*1000);
s.setSoTimeout(60_000);
InputStream in = s.getInputStream();
expectThrows(IOException.class, () -> in.read());
} finally {
Expand All @@ -228,7 +228,7 @@ public void testTimedRead6() throws Exception {
Future<?> interrupter = scheduleInterrupt(Thread.currentThread(), 2000);
Socket s = sc.socket();
try {
s.setSoTimeout(60*1000);
s.setSoTimeout(60_000);
InputStream in = s.getInputStream();
expectThrows(IOException.class, () -> in.read());
assertTrue(s.isClosed());
Expand Down Expand Up @@ -396,7 +396,7 @@ public void testConcurrentTimedReadWrite1() throws Exception {

// test read when bytes are available
peer.getOutputStream().write(99);
s.setSoTimeout(60*1000);
s.setSoTimeout(60_000);
int n = s.getInputStream().read();
assertEquals(n, 99);
});
Expand All @@ -421,7 +421,7 @@ public void testConcurrentTimedReadWrite2() throws Exception {

// test read blocking until bytes are available
scheduleWrite(peer.getOutputStream(), 99, 500);
s.setSoTimeout(60*1000);
s.setSoTimeout(60_000);
int n = s.getInputStream().read();
assertEquals(n, 99);
});
Expand All @@ -436,7 +436,7 @@ public void testConcurrentTimedReadWrite3() throws Exception {

// block thread in read
execute(() -> {
s.setSoTimeout(60*1000);
s.setSoTimeout(60_000);
s.getInputStream().read();
});
Thread.sleep(100); // give reader time to block
Expand Down

0 comments on commit a8ab70a

Please sign in to comment.