@Test
    public void testCantSendWithInProgress() throws Exception {
        String node = "0";
        blockingConnect(node);
        selector.send(createSend(node, "test1"));
        try {
            selector.send(createSend(node, "test2"));
            fail("IllegalStateException not thrown when sending a request with one in flight");
        } catch (IllegalStateException e) {
            // Expected exception
        }
        selector.poll(0);
        assertTrue(selector.disconnected().containsKey(node), "Channel not closed");
        assertEquals(ChannelState.FAILED_SEND, selector.disconnected().get(node));
    }
Sending a request with one already in flight should result in an exception
clients/src/test/java/org/apache/kafka/common/network/SelectorTest.java