public void logFrameIn(
        final DirectBuffer buffer, final int offset, final int frameLength, final InetSocketAddress dstAddress)
    {
        final int length = frameLength + socketAddressLength(dstAddress);
        final int captureLength = captureLength(length);
        final int encodedLength = encodedLength(captureLength);

        final ManyToOneRingBuffer ringBuffer = this.ringBuffer;
        final int index = ringBuffer.tryClaim(toEventCodeId(FRAME_IN), encodedLength);
        if (index > 0)
        {
            try
            {
                encode((UnsafeBuffer)ringBuffer.buffer(), index, captureLength, length, buffer, offset, dstAddress);
            }
            finally
            {
                ringBuffer.commit(index);
            }
        }
    }
@Test
    void logFrameIn()
    {
        final int recordOffset = align(100, ALIGNMENT);
        logBuffer.putLong(CAPACITY + TAIL_POSITION_OFFSET, recordOffset);
        final int length = 10_000;
        final int captureLength = MAX_CAPTURE_LENGTH;
        final int srcOffset = 4;
        buffer.setMemory(srcOffset, MAX_CAPTURE_LENGTH, (byte)3);
        final int encodedSocketLength = 12;

        logger.logFrameIn(buffer, srcOffset, length, new InetSocketAddress("localhost", 5555));

        verifyLogHeader(logBuffer, recordOffset, toEventCodeId(FRAME_IN), captureLength, length + encodedSocketLength);
        assertEquals(5555, logBuffer.getInt(encodedMsgOffset(recordOffset + LOG_HEADER_LENGTH), LITTLE_ENDIAN));
        assertEquals(srcOffset,
            logBuffer.getInt(encodedMsgOffset(recordOffset + LOG_HEADER_LENGTH + SIZE_OF_INT), LITTLE_ENDIAN));

        for (int i = 0; i < captureLength - encodedSocketLength; i++)
        {
            assertEquals(3,
                logBuffer.getByte(encodedMsgOffset(recordOffset + LOG_HEADER_LENGTH + encodedSocketLength + i)));
        }
    }