NettyWritable implements WritableBuffer { @Override public boolean hasRemaining() { return nettyBuffer.writerIndex() < nettyBuffer.capacity(); } NettyWritable(ByteBuf nettyBuffer); ByteBuf getByteBuf(); @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 putShort(short s); @Override void putInt(int i); @Override void putLong(long l); @Override boolean hasRemaining(); @Override int remaining(); @Override void ensureRemaining(int remaining); @Override int position(); @Override void position(int position); @Override void put(ByteBuffer payload); void put(ByteBuf payload); @Override void put(String value); @Override int limit(); @Override void put(ReadableBuffer buffer);  }
@Test public void testHasRemaining() { ByteBuf buffer = Unpooled.buffer(100, 100); NettyWritable writable = new NettyWritable(buffer); assertTrue(writable.hasRemaining()); writable.put((byte) 0); assertTrue(writable.hasRemaining()); buffer.writerIndex(buffer.maxCapacity()); assertFalse(writable.hasRemaining()); }