public static ByteBuffer toBuffer(Send send) {
        ByteBufferChannel channel = new ByteBufferChannel(send.size());
        try {
            assertEquals(send.size(), send.writeTo(channel));
            channel.close();
            return channel.buffer();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
Checks the two iterables for equality by first converting both to a list.
clients/src/test/java/org/apache/kafka/test/TestUtils.java