@VisibleForTesting
  ByteBuffer getPoolableBuffer(final ByteBuffer buffer) {
    final Object attachment = DirectBuffer.attachment(buffer);

    if (null == attachment) {
      return buffer;
    }

    if (attachment instanceof ByteBuffer) {
      return (ByteBuffer) attachment;
    }

    throw new InternalGemFireException("direct byte buffer attachment was not a byte buffer but a "
        + attachment.getClass().getName());
  }
If we hand out a buffer that is larger than the requested size we create a
"slice" of the buffer having the requested capacity and hand that out instead.
When we put the buffer back in the pool we need to find the original, non-sliced,
buffer. This is held in DirectBuffer in its "attachment" field.

This method is visible for use in debugging and testing. For debugging, invoke this method if
you need to see the non-sliced buffer for some reason, such as logging its hashcode.
geode-core/src/main/java/org/apache/geode/internal/net/BufferPool.java