public static AllocatedBuffer wrap(final ByteBuffer buffer) {
        checkNotNull(buffer, "buffer");

        return new AllocatedBuffer() {

            @Override
            public ByteBuffer nioBuffer() {
                return buffer;
            }

            @Override
            public AllocatedBuffer release() {
                // Do nothing.
                return this;
            }
        };
    }
Creates a new {@link AllocatedBuffer} that is backed by the given {@link ByteBuffer}.
common/src/main/java/org/conscrypt/AllocatedBuffer.java