### Question:
BufferReaderWriterUtil { @Nullable static Buffer sliceNextBuffer(ByteBuffer memory) { final int remaining = memory.remaining(); if (remaining == 0) { return null; } final int header = memory.getInt(); final int size = memory.getInt(); memory.limit(memory.position() + size); ByteBuffer buf = memory.slice(); memory.position(memory.limit()); memory.limit(memory.capacity()); MemorySegment memorySegment = MemorySegmentFactory.wrapOffHeapMemory(buf); return bufferFromMemorySegment( memorySegment, FreeingBufferRecycler.INSTANCE, size, header == HEADER_VALUE_IS_EVENT); }    }### Answer:
@Test public void readFromEmptyByteBuffer() { final ByteBuffer memory = ByteBuffer.allocateDirect(100); memory.position(memory.limit()); final Buffer result = BufferReaderWriterUtil.sliceNextBuffer(memory); assertNull(result); }