buf.putShort(len);
buf.put(expected);
buf = buf.asReadOnlyBuffer();
buf.flip();
for (; buf.hasRemaining(); buf.skip(1)) {
assertEquals(0, sentMessages.size());
assertEquals(0, receivedMessages.size());
ByteBuffer singleByte = buf.slice().limit(1);
harness.recv(singleByte);
}