use of org.asynchttpclient.request.body.Body in project async-http-client by AsyncHttpClient.
the class FeedableBodyGeneratorTest method readingBytesReturnsFedContentWithoutChunkBoundaries.
@Test
public void readingBytesReturnsFedContentWithoutChunkBoundaries() throws Exception {
byte[] content = "Test123".getBytes(StandardCharsets.US_ASCII);
ByteBuf source = Unpooled.wrappedBuffer(content);
ByteBuf target = Unpooled.buffer(1);
try {
feedableBodyGenerator.feed(source, true);
Body body = feedableBodyGenerator.createBody();
assertEquals(readFromBody(body), "Test123".getBytes(StandardCharsets.US_ASCII));
assertEquals(body.transferTo(target), BodyState.STOP);
} finally {
source.release();
target.release();
}
}
Aggregations