divijvaidya commented on code in PR #12159:
URL: https://github.com/apache/kafka/pull/12159#discussion_r873646603


##########
clients/src/test/java/org/apache/kafka/common/network/SelectorTest.java:
##########
@@ -449,9 +450,9 @@ public void close() {
     @Test
     public void testCloseOldestConnection() throws Exception {
         String id = "0";
-        blockingConnect(id);
-
-        time.sleep(6000); // The max idle time is 5000ms
+        selector.connect(id, new InetSocketAddress("localhost", server.port), 
BUFFER_SIZE, BUFFER_SIZE);
+        selector.poll(0);

Review Comment:
   Note that `connect()` is synchronous method here. It might not complete with 
the first poll event. That is the reason it is tested in a while loop inside 
`blockingConnect`.
   
   My suggestion would be to keep using blockingConnect with a (new) timeout to 
terminate while loop in it similar to implementation of 
`NetworkTestUtils.waitForChannelReady`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to