public static void waitForChannelReady(Selector selector, String node) throws IOException {
        // wait for handshake to finish
        int secondsLeft = 30;
        while (!selector.isChannelReady(node) && secondsLeft-- > 0) {
            selector.poll(1000L);
        }
        assertTrue(selector.isChannelReady(node), String.format("Channel %s was not ready after 30 seconds", node));
    }
Common utility functions used by transport layer and authenticator tests.
clients/src/test/java/org/apache/kafka/common/network/NetworkTestUtils.java