### Question:
BufUnwrapper implements AutoCloseable { ByteBuffer[] readableNioBuffers(ByteBuf buf) { return nioBuffers(buf, singleReadBuffer); }  @Override void close();  }### Answer:
@Test public void readableNioBuffers_worksWithNormal() { ByteBuf buf = alloc.buffer(1).writeByte('a'); try (BufUnwrapper unwrapper = new BufUnwrapper()) { ByteBuffer[] internalBufs = unwrapper.readableNioBuffers(buf); Truth.assertThat(internalBufs).hasLength(1); assertEquals('a', internalBufs[0].get(0)); } finally { buf.release(); } }
@Test public void readableNioBuffers_worksWithComposite() { CompositeByteBuf buf = alloc.compositeBuffer(); buf.addComponent(true, alloc.buffer(1).writeByte('a')); try (BufUnwrapper unwrapper = new BufUnwrapper()) { ByteBuffer[] internalBufs = unwrapper.readableNioBuffers(buf); Truth.assertThat(internalBufs).hasLength(1); assertEquals('a', internalBufs[0].get(0)); } finally { buf.release(); } }