// Make sure the buffer shrinks when 0 byte is being used.
buf.fill(32);
buf.compact();
assertEquals(8, buf.capacity());
assertEquals(0, buf.position());
assertEquals(8, buf.limit());
// Expand the buffer.
buf.capacity(32).clear();
assertEquals(32, buf.capacity());