public void logFrameOut(final ByteBuffer buffer, final InetSocketAddress dstAddress)
    {
        final int length = buffer.remaining() + socketAddressLength(dstAddress);
        final int captureLength = captureLength(length);
        final int encodedLength = encodedLength(captureLength);

        final ManyToOneRingBuffer ringBuffer = this.ringBuffer;
        final int index = ringBuffer.tryClaim(toEventCodeId(FRAME_OUT), encodedLength);
        if (index > 0)
        {
            try
            {
                encode(
                    (UnsafeBuffer)ringBuffer.buffer(),
                    index,
                    captureLength,
                    length,
                    buffer,
                    buffer.position(),
                    dstAddress);
            }
            finally
            {
                ringBuffer.commit(index);
            }
        }
    }
@Test
    void logFrameOut()
    {
        final int recordOffset = 24;
        logBuffer.putLong(CAPACITY + TAIL_POSITION_OFFSET, recordOffset);
        final ByteBuffer byteBuffer = buffer.byteBuffer();
        byteBuffer.position(8);
        final byte[] bytes = new byte[32];
        fill(bytes, (byte)-1);
        byteBuffer.put(bytes);
        byteBuffer.flip().position(10).limit(38);
        final int encodedSocketLength = 12;
        final int length = byteBuffer.remaining() + encodedSocketLength;
        final int arrayCaptureLength = length - encodedSocketLength;

        logger.logFrameOut(byteBuffer, new InetSocketAddress("localhost", 3232));

        verifyLogHeader(logBuffer, recordOffset, toEventCodeId(FRAME_OUT), length, length);
        assertEquals(3232, logBuffer.getInt(encodedMsgOffset(recordOffset + LOG_HEADER_LENGTH), LITTLE_ENDIAN));
        assertEquals(4,
            logBuffer.getInt(encodedMsgOffset(recordOffset + LOG_HEADER_LENGTH + SIZE_OF_INT), LITTLE_ENDIAN));

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