public ByteBuf allocateBuffer(ByteBufAllocator allocator) {
    if (configuration.isPreferDirectBuffer()) {
      return allocator.ioBuffer();
    }

    return allocator.heapBuffer();
  }
 @Override
 public ByteBuf allocate(ByteBufAllocator alloc) {
   return alloc.ioBuffer(nextReceiveBufferSize);
 }