@Test
    public void testWriteCompletesSendWithNoBytesWritten() throws IOException {
        KafkaChannel channel = mock(KafkaChannel.class);
        when(channel.id()).thenReturn("1");
        when(channel.write()).thenReturn(0L);
        NetworkSend send = new NetworkSend("destination", new ByteBufferSend(ByteBuffer.allocate(0)));
        when(channel.maybeCompleteSend()).thenReturn(send);
        selector.write(channel);
        assertEquals(Collections.singletonList(send), selector.completedSends());
    }
Tests that a connect and disconnect in a single poll invocation results in the channel id being
in `disconnected`, but not `connected`.
clients/src/test/java/org/apache/kafka/common/network/SelectorTest.java