About capacity(), grizzly provider's pure allocation and converting grizzly's Buffer to ByteBuffer doesn't guarantee remaining equals capacity. When I tested the ByteBuffer's capacity is larger than limit(at the pos is 0). If capacity() should be used, maybe ByteBuffer#slice() will be needed after allocation.

For your help, here are grizzly provider's javadoc for Buffer(allocation and converting to ByteBuffer).
---
/**
     * <p>
     * Converts this <code>Buffer</code> to a {@link ByteBuffer}.
     * If this <code>Buffer</code> is not composite - then returned
     * {@link ByteBuffer}'s content is a shared subsequence of this buffer's
     * content, with {@link CompositeBuffer} this is not guaranteed.
     * The position of the returned {@link ByteBuffer} is not guaranteed to be 0,
     * the capacity of the returned {@link ByteBuffer} is not guaranteed to be
     * equal to the capacity of this <code>Buffer</code>.
     * It is guaranteed that the result of the returned ByteBuffer's
     * {@link ByteBuffer#remaining()} call will be equal to this Buffer's
     * {@link #remaining()} call.
     * The Buffer's and ByteBuffer's position, limit, and mark values are not
     * guaranteed to be independent, so it's recommended to save and restore
     * position, limit values if it is planned to change them or
     * {@link ByteBuffer#slice()} the returned {@link ByteBuffer}.
     * <p/>
     *
     * @return this <code>Buffer</code> as a {@link ByteBuffer}.
     */
    ByteBuffer toByteBuffer();
---