code: public static WsByteBuffer allocateByteBuffer(int size, boolean allocateDirect) {
          WsByteBuffer newBuffer = null;
          // Allocate based on the input parameter.
          if (allocateDirect) {
              newBuffer = ChannelFrameworkFactory.getBufferManager().allocateDirect(size);
          } else {
              newBuffer = ChannelFrameworkFactory.getBufferManager().allocate(size);
          }
          // Shift the limit to the capacity to maximize the space available in the buffer.
          newBuffer.limit(newBuffer.capacity());
          return newBuffer;
      }
docs: Allocate a ByteBuffer per the SSL config at least as big as the input size.
  
  @param size Minimum size of the resulting buffer.
  @param allocateDirect flag to indicate if allocation should be done with direct byte buffers.
  @return Newly allocated ByteBuffer