use of io.netty.buffer.PooledByteBufAllocator in project netty by netty.
the class AbstractSslHandlerThroughputBenchmark method setup.
@Setup(Level.Iteration)
public final void setup() throws Exception {
allocator = new PooledByteBufAllocator(true);
initSslHandlers(allocator);
wrapSrcBuffer = allocateBuffer(messageSize);
byte[] bytes = new byte[messageSize];
PlatformDependent.threadLocalRandom().nextBytes(bytes);
wrapSrcBuffer.writeBytes(bytes);
// Complete the initial TLS handshake.
doHandshake();
}
use of io.netty.buffer.PooledByteBufAllocator in project netty by netty.
the class SslEngineHandshakeBenchmark method setup.
@Setup(Level.Iteration)
public void setup() {
allocator = new PooledByteBufAllocator(true);
// Init an engine one time and create the buffers needed for an handshake so we can use them in the benchmark
initEngines(allocator);
initHandshakeBuffers();
destroyEngines();
}
use of io.netty.buffer.PooledByteBufAllocator in project redisson by redisson.
the class JsonJacksonMapValueCodecTest method shouldDeserializeTheStringCorrectly.
@Test
public void shouldDeserializeTheStringCorrectly() throws Exception {
ByteBuf buf = new PooledByteBufAllocator(true).buffer();
buf.writeBytes(new ObjectMapper().writeValueAsBytes("axk"));
assertThat(stringCodec.getMapValueDecoder().decode(buf, new State(false))).isInstanceOf(String.class).isEqualTo("axk");
}
use of io.netty.buffer.PooledByteBufAllocator in project motan by weibocom.
the class NettyHttpRequestHandlerTest method buildHttpRequest.
private FullHttpRequest buildHttpRequest(String requestPath) throws Exception {
PooledByteBufAllocator allocator = new PooledByteBufAllocator();
ByteBuf buf = allocator.buffer(0);
FullHttpRequest httpReqeust = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, requestPath, buf);
return httpReqeust;
}
use of io.netty.buffer.PooledByteBufAllocator in project motan by weibocom.
the class YarMessageHandlerWarpperTest method buildHttpRequest.
private FullHttpRequest buildHttpRequest(YarRequest yarRequest, String requestPath) throws Exception {
PooledByteBufAllocator allocator = new PooledByteBufAllocator();
ByteBuf buf = allocator.buffer(2048, 1024 * 1024);
if (yarRequest != null) {
buf.writeBytes(YarProtocol.toProtocolBytes(yarRequest));
}
FullHttpRequest httpReqeust = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, requestPath, buf);
return httpReqeust;
}
Aggregations