buffer.write(payload, 0, payload.length);
assertEquals(payload.length, buffer.availableForWrite());
buffer.write(payload, 0, payload.length);
assertEquals(0, buffer.availableForWrite());
buffer.write(payload, 0, payload.length);
assertEquals(0, buffer.availableForWrite());
}
@Test
public void testBufferDrain() throws Exception {
CircularBuffer buffer = new CircularBuffer(payload.length * 2);