code: private void setRecvByteBufAllocator(RecvByteBufAllocator allocator, ChannelMetadata metadata) {
          if (allocator instanceof MaxMessagesRecvByteBufAllocator) {
              ((MaxMessagesRecvByteBufAllocator) allocator).maxMessagesPerRead(metadata.defaultMaxMessagesPerRead());
          } else if (allocator == null) {
              throw new NullPointerException("allocator");
          }
          setRecvByteBufAllocator(allocator);
      }
docs: Set the {@link RecvByteBufAllocator} which is used for the channel to allocate receive buffers.
  @param allocator the allocator to set.
  @param metadata Used to set the {@link ChannelMetadata#defaultMaxMessagesPerRead()} if {@code allocator}
  is of type {@link MaxMessagesRecvByteBufAllocator}.