@Nullable
    @Override
    public BufferAndBacklog getNextBuffer() throws IOException {
        if (stopSendingData || !findCurrentNettyPayloadQueue()) {
            return null;
        }
        NettyPayloadManager nettyPayloadManager =
                nettyPayloadManagers.get(managerIndexContainsCurrentSegment);
        Optional<Buffer> nextBuffer = readNettyPayload(nettyPayloadManager);
        if (nextBuffer.isPresent()) {
            stopSendingData = nextBuffer.get().getDataType() == END_OF_SEGMENT;
            if (stopSendingData) {
                managerIndexContainsCurrentSegment = -1;
            }
            currentSequenceNumber++;
            return BufferAndBacklog.fromBufferAndLookahead(
                    nextBuffer.get(),
                    getDataType(nettyPayloadManager.peek()),
                    getBacklog(),
                    currentSequenceNumber);
        }
        return null;
    }
@Test
    void testGetNextBuffer() throws IOException {
        checkBufferAndBacklog(tieredStorageResultSubpartitionView.getNextBuffer(), 0);
        tieredStorageResultSubpartitionView.notifyRequiredSegmentId(0, 1);
        assertThat(availabilityListener).isDone();
        checkBufferAndBacklog(tieredStorageResultSubpartitionView.getNextBuffer(), 0);
        assertThat(tieredStorageResultSubpartitionView.getNextBuffer()).isNull();
    }