lh0156 commented on code in PR #22943:
URL: https://github.com/apache/kafka/pull/22943#discussion_r3687582595


##########
clients/src/test/java/org/apache/kafka/common/network/SelectorTest.java:
##########
@@ -454,7 +454,7 @@ public void registerFailure() throws Exception {
     public void testCloseOldestConnection() throws Exception {
         String id = "0";
         selector.connect(id, new InetSocketAddress("localhost", server.port), 
BUFFER_SIZE, BUFFER_SIZE);
-        NetworkTestUtils.waitForChannelConnected(selector, id);
+        NetworkTestUtils.waitForChannelReady(selector, id);

Review Comment:
   You are right that `SslTransportLayer.ready()` also returns true for 
`POST_HANDSHAKE`. While reproducing this, I found a second ordering issue in 
the shared test: for plaintext, `waitForChannelReady` can return before 
`immediatelyConnectedKeys` has been processed, so the first poll after 
advancing MockTime refreshes the idle timestamp instead of expiring the 
connection. The test now waits for TCP connectivity first and protocol 
readiness second. This keeps the TLS 1.3 handshake/post-handshake precondition 
explicit and makes the idle interval start only after the connection has been 
processed. `SelectorTest`, `Tls12SelectorTest`, and `Tls13SelectorTest` all 
pass with this change.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to