Search in sources :

Example 6 with PooledByteBufAllocator

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();
}
Also used : PooledByteBufAllocator(io.netty.buffer.PooledByteBufAllocator) Setup(org.openjdk.jmh.annotations.Setup)

Example 7 with PooledByteBufAllocator

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();
}
Also used : PooledByteBufAllocator(io.netty.buffer.PooledByteBufAllocator) Setup(org.openjdk.jmh.annotations.Setup)

Example 8 with PooledByteBufAllocator

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");
}
Also used : State(org.redisson.client.handler.State) ByteBuf(io.netty.buffer.ByteBuf) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) PooledByteBufAllocator(io.netty.buffer.PooledByteBufAllocator) Test(org.junit.Test)

Example 9 with PooledByteBufAllocator

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;
}
Also used : DefaultFullHttpRequest(io.netty.handler.codec.http.DefaultFullHttpRequest) FullHttpRequest(io.netty.handler.codec.http.FullHttpRequest) DefaultFullHttpRequest(io.netty.handler.codec.http.DefaultFullHttpRequest) ByteBuf(io.netty.buffer.ByteBuf) PooledByteBufAllocator(io.netty.buffer.PooledByteBufAllocator)

Example 10 with PooledByteBufAllocator

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;
}
Also used : DefaultFullHttpRequest(io.netty.handler.codec.http.DefaultFullHttpRequest) FullHttpRequest(io.netty.handler.codec.http.FullHttpRequest) DefaultFullHttpRequest(io.netty.handler.codec.http.DefaultFullHttpRequest) ByteBuf(io.netty.buffer.ByteBuf) PooledByteBufAllocator(io.netty.buffer.PooledByteBufAllocator)

Aggregations

PooledByteBufAllocator (io.netty.buffer.PooledByteBufAllocator)12 ByteBuf (io.netty.buffer.ByteBuf)6 Setup (org.openjdk.jmh.annotations.Setup)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 DefaultFullHttpRequest (io.netty.handler.codec.http.DefaultFullHttpRequest)2 FullHttpRequest (io.netty.handler.codec.http.FullHttpRequest)2 Test (org.junit.Test)2 State (org.redisson.client.handler.State)2 Metrics (com.yahoo.pulsar.broker.stats.Metrics)1 AllocatorStats (com.yahoo.pulsar.common.stats.AllocatorStats)1 Metadata (io.grpc.Metadata)1 ServerCall (io.grpc.ServerCall)1 ServerCallHandler (io.grpc.ServerCallHandler)1 ServiceDescriptor (io.grpc.ServiceDescriptor)1 ByteBufOutputMarshaller (io.grpc.benchmarks.ByteBufOutputMarshaller)1 NettyChannelBuilder (io.grpc.netty.NettyChannelBuilder)1 NettyServerBuilder (io.grpc.netty.NettyServerBuilder)1 ByteBufAllocator (io.netty.buffer.ByteBufAllocator)1 PoolArenaMetric (io.netty.buffer.PoolArenaMetric)1 PoolChunkListMetric (io.netty.buffer.PoolChunkListMetric)1