@Test public void testCompositeSendWithByteBuf() { byte[] buf1 = new byte[1024]; byte[] buf2 = new byte[2048]; byte[] buf3 = new byte[4096]; new Random().nextBytes(buf1); new Random().nextBytes(buf2); new Random().nextBytes(buf3); ByteArraySend byteArraySend1 = new ByteArraySend(buf1, true); ByteArraySend byteArraySend2 = new ByteArraySend(buf2, true); ByteArraySend byteArraySend3 = new ByteArraySend(buf3, true); List<Send> listToSend = new ArrayList<Send>(3); listToSend.add(byteArraySend1); listToSend.add(byteArraySend2); listToSend.add(byteArraySend3); CompositeSend compositeSend = new CompositeSend(listToSend); ByteBuf content = compositeSend.content(); for (int i = 0; i < 1024; i++) { Assert.assertEquals(buf1[i], content.getByte(i)); } for (int i = 0; i < 2048; i++) { Assert.assertEquals(buf2[i], content.getByte(1024 + i)); } for (int i = 0; i < 4096; i++) { Assert.assertEquals(buf3[i], content.getByte(1024 + 2048 + i)); } content.release(); }
@Override public ByteBuf content() { return compositeSendContent; }
CompositeSend extends AbstractByteBufHolder<CompositeSend> implements Send { @Override public ByteBuf content() { return compositeSendContent; } }
CompositeSend extends AbstractByteBufHolder<CompositeSend> implements Send { @Override public ByteBuf content() { return compositeSendContent; } CompositeSend(List<Send> compositeSendList); }
CompositeSend extends AbstractByteBufHolder<CompositeSend> implements Send { @Override public ByteBuf content() { return compositeSendContent; } CompositeSend(List<Send> compositeSendList); @Override long writeTo(WritableByteChannel channel); @Override void writeTo(AsyncWritableChannel channel, Callback<Long> callback); @Override boolean isSendComplete(); @Override long sizeInBytes(); @Override ByteBuf content(); @Override CompositeSend replace(ByteBuf content); }
CompositeSend extends AbstractByteBufHolder<CompositeSend> implements Send { @Override public ByteBuf content() { return compositeSendContent; } CompositeSend(List<Send> compositeSendList); @Override long writeTo(WritableByteChannel channel); @Override void writeTo(AsyncWritableChannel channel, Callback<Long> callback); @Override boolean isSendComplete(); @Override long sizeInBytes(); @Override ByteBuf content(); @Override CompositeSend replace(ByteBuf content);  }