public void closeKafkaChannels() {
        closeKafkaChannels = true;
        selector.wakeup();
        try {
            TestUtils.waitForCondition(() -> selector.channels().isEmpty(), "Channels not closed");
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        } finally {
            closeKafkaChannels = false;
        }
    }
Sets the output channel to which messages received on this server are echoed.
This is useful in tests where the clients sending the messages don't receive
the responses (eg. testing graceful close).
clients/src/test/java/org/apache/kafka/common/network/NioEchoServer.java