@Test public void testSingleRead() throws IOException { final int srcArraySize = chunkSize - 1; final byte[] srcArray = new byte[srcArraySize]; random.nextBytes(srcArray); final ByteArrayBodyGenerator babGen = new ByteArrayBodyGenerator(srcArray); final Body body = babGen.createBody(); final ByteBuf chunkBuffer = Unpooled.buffer(chunkSize); try { body.transferTo(chunkBuffer); assertEquals(chunkBuffer.readableBytes(), srcArraySize, "bytes read"); chunkBuffer.clear(); assertEquals(body.transferTo(chunkBuffer), BodyState.STOP, "body at EOF"); } finally { chunkBuffer.release(); } }
@Override public Body createBody() { return new ByteBody(); }
ByteArrayBodyGenerator implements BodyGenerator { @Override public Body createBody() { return new ByteBody(); } }
ByteArrayBodyGenerator implements BodyGenerator { @Override public Body createBody() { return new ByteBody(); } ByteArrayBodyGenerator(byte[] bytes); }
ByteArrayBodyGenerator implements BodyGenerator { @Override public Body createBody() { return new ByteBody(); } ByteArrayBodyGenerator(byte[] bytes); @Override Body createBody(); }
ByteArrayBodyGenerator implements BodyGenerator { @Override public Body createBody() { return new ByteBody(); } ByteArrayBodyGenerator(byte[] bytes); @Override Body createBody();  }