### Question:
AmqpWritableBuffer implements WritableBuffer { @Override public int remaining() { return nettyBuffer.maxCapacity() - nettyBuffer.writerIndex(); } AmqpWritableBuffer();  AmqpWritableBuffer(ByteBuf buffer); ByteBuf getBuffer(); @Override void put(byte b); @Override void putFloat(float f); @Override void putDouble(double d); @Override void put(byte[] src, int offset, int length); @Override void put(ByteBuffer payload); void put(ByteBuf payload); @Override void putShort(short s); @Override void putInt(int i); @Override void putLong(long l); @Override void put(String value); @Override boolean hasRemaining(); @Override int remaining(); @Override void ensureRemaining(int remaining); @Override int position(); @Override void position(int position); @Override int limit(); @Override void put(ReadableBuffer buffer); static final int INITIAL_CAPACITY; public ByteBuf nettyBuffer; }### Answer:
@Test public void testRemaining() { ByteBuf buffer = Unpooled.buffer(1024); AmqpWritableBuffer writable = new AmqpWritableBuffer(buffer); assertEquals(buffer.maxCapacity(), writable.remaining()); writable.put((byte) 0); assertEquals(buffer.maxCapacity() - 1, writable.remaining()); }