Search in sources :

Example 1 with StompHeadersSubframe

use of io.netty.handler.codec.stomp.StompHeadersSubframe in project netty by netty.

the class StompEncoderBenchmark method setup.

@Setup(Level.Trial)
public void setup() {
    byte[] bytes = new byte[contentLength];
    ThreadLocalRandom.current().nextBytes(bytes);
    content = Unpooled.wrappedBuffer(bytes);
    ByteBuf testContent = Unpooled.unreleasableBuffer(content.asReadOnly());
    StompHeadersSubframe headersSubframe = ExampleStompHeadersSubframe.EXAMPLES.get(headersType);
    stompFrame = new DefaultStompFrame(headersSubframe.command(), testContent);
    stompFrame.headers().setAll(headersSubframe.headers());
    stompEncoder = new StompSubframeEncoder();
    context = new EmbeddedChannelWriteReleaseHandlerContext(pooledAllocator ? PooledByteBufAllocator.DEFAULT : UnpooledByteBufAllocator.DEFAULT, stompEncoder) {

        @Override
        protected void handleException(Throwable t) {
            handleUnexpectedException(t);
        }
    };
}
Also used : StompHeadersSubframe(io.netty.handler.codec.stomp.StompHeadersSubframe) EmbeddedChannelWriteReleaseHandlerContext(io.netty.microbench.channel.EmbeddedChannelWriteReleaseHandlerContext) ByteBuf(io.netty.buffer.ByteBuf) StompSubframeEncoder(io.netty.handler.codec.stomp.StompSubframeEncoder) DefaultStompFrame(io.netty.handler.codec.stomp.DefaultStompFrame) Setup(org.openjdk.jmh.annotations.Setup)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)1 DefaultStompFrame (io.netty.handler.codec.stomp.DefaultStompFrame)1 StompHeadersSubframe (io.netty.handler.codec.stomp.StompHeadersSubframe)1 StompSubframeEncoder (io.netty.handler.codec.stomp.StompSubframeEncoder)1 EmbeddedChannelWriteReleaseHandlerContext (io.netty.microbench.channel.EmbeddedChannelWriteReleaseHandlerContext)1 Setup (org.openjdk.jmh.annotations.Setup)1