Skip to content
Permalink
Browse files
8259628: jdk/net/ExtendedSocketOption/AsynchronousSocketChannelNAPITe…
…st.java fails intermittently

Reviewed-by: dfuchs
  • Loading branch information
pconcannon committed Jan 28, 2021
1 parent baf46ba commit 13ca433ff66e202710735134e072178557114ad4
Showing 1 changed file with 6 additions and 5 deletions.
@@ -95,7 +95,7 @@ public void testSetGetOptionServerSocketChannel() throws IOException {

@Test
public void testSocketChannel() throws Exception {
int socketID, clientID, tempID = 0;
int socketID, clientID, originalClientID = 0;
boolean initialRun = true;
try (var ss = AsynchronousServerSocketChannel.open()) {
ss.bind(new InetSocketAddress(hostAddr, 0));
@@ -108,20 +108,21 @@ public void testSocketChannel() throws Exception {

for (int i = 0; i < 10; i++) {
s.write(ByteBuffer.wrap("test".getBytes()));

socketID = s.getOption(SO_INCOMING_NAPI_ID);
assertEquals(socketID, 0, "AsynchronousSocketChannel: Sender");

c.read(ByteBuffer.allocate(128));
c.read(ByteBuffer.allocate(128)).get();
clientID = ss.getOption(SO_INCOMING_NAPI_ID);

// check ID remains consistent
if (initialRun) {
assertTrue(clientID >= 0, "AsynchronousSocketChannel: Receiver");
} else {
assertEquals(clientID, tempID);
initialRun = false;
originalClientID = clientID;
} else {
assertEquals(clientID, originalClientID);
}
tempID = clientID;
}
}
}

1 comment on commit 13ca433

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 13ca433 Jan 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.