assertEquals(4, buf.limit());
assertEquals(4, buf.capacity());
// Make sure the buffer is doubled up.
buf = IoBuffer.allocate(1).setAutoExpand(true);
int lastCapacity = buf.capacity();
for (int i = 0; i < 1048576; i++) {
buf.put((byte) 0);
if (lastCapacity != buf.capacity()) {
assertEquals(lastCapacity * 2, buf.capacity());
lastCapacity = buf.capacity();