public ReportEntry createEntry(
        final long initialBytesLost,
        final long timestampMs,
        final int sessionId,
        final int streamId,
        final String channel,
        final String source)
    {
        ReportEntry reportEntry = null;

        final int requiredCapacity =
            CHANNEL_OFFSET +
            BitUtil.align(SIZE_OF_INT + channel.length(), SIZE_OF_INT) +
            SIZE_OF_INT + source.length();

        if (requiredCapacity <= (buffer.capacity() - nextRecordOffset))
        {
            final int offset = nextRecordOffset;

            buffer.putLong(offset + TOTAL_BYTES_LOST_OFFSET, initialBytesLost);
            buffer.putLong(offset + FIRST_OBSERVATION_OFFSET, timestampMs);
            buffer.putLong(offset + LAST_OBSERVATION_OFFSET, timestampMs);
            buffer.putInt(offset + SESSION_ID_OFFSET, sessionId);
            buffer.putInt(offset + STREAM_ID_OFFSET, streamId);

            final int encodedChannelLength = buffer.putStringAscii(offset + CHANNEL_OFFSET, channel);

            buffer.putStringAscii(
                offset + CHANNEL_OFFSET + BitUtil.align(encodedChannelLength, SIZE_OF_INT), source);

            buffer.putLongOrdered(offset + OBSERVATION_COUNT_OFFSET, 1);

            reportEntry = new ReportEntry(buffer, offset);
            nextRecordOffset += BitUtil.align(requiredCapacity, ENTRY_ALIGNMENT);
        }

        return reportEntry;
    }
@Test
    void shouldCreateEntry()
    {
        final long initialBytesLost = 32;
        final int timestampMs = 7;
        final int sessionId = 3;
        final int streamId = 1;
        final String channel = "aeron:udp://stuff";
        final String source = "127.0.0.1:8888";

        assertNotNull(lossReport.createEntry(initialBytesLost, timestampMs, sessionId, streamId, channel, source));

        final InOrder inOrder = inOrder(buffer);
        inOrder.verify(buffer).putLong(TOTAL_BYTES_LOST_OFFSET, initialBytesLost);
        inOrder.verify(buffer).putLong(FIRST_OBSERVATION_OFFSET, timestampMs);
        inOrder.verify(buffer).putLong(LAST_OBSERVATION_OFFSET, timestampMs);
        inOrder.verify(buffer).putInt(SESSION_ID_OFFSET, sessionId);
        inOrder.verify(buffer).putInt(STREAM_ID_OFFSET, streamId);
        inOrder.verify(buffer).putStringAscii(CHANNEL_OFFSET, channel);
        inOrder.verify(buffer).putStringAscii(
            CHANNEL_OFFSET + BitUtil.align(SIZE_OF_INT + channel.length(), SIZE_OF_INT), source);
        inOrder.verify(buffer).putLongOrdered(OBSERVATION_COUNT_OFFSET, 1L);
    }