Example usage for io.netty.buffer PooledByteBufAllocator buffer

List of usage examples for io.netty.buffer PooledByteBufAllocator buffer

Introduction

In this page you can find the example usage for io.netty.buffer PooledByteBufAllocator buffer.

Prototype

@Override
    public ByteBuf buffer(int initialCapacity, int maxCapacity) 

Source Link

Usage

From source file:com.weibo.api.motan.transport.netty4.yar.YarMessageHandlerWarpperTest.java

License:Apache License

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));
    }/*from  www  . j a va2 s  .c o  m*/
    FullHttpRequest httpReqeust = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, requestPath,
            buf);
    return httpReqeust;
}