public void logAddress(final DriverEventCode code, final InetSocketAddress address)
    {
        final int length = socketAddressLength(address);
        final int captureLength = captureLength(length);
        final int encodedLength = encodedLength(captureLength);

        final ManyToOneRingBuffer ringBuffer = this.ringBuffer;
        final int index = ringBuffer.tryClaim(toEventCodeId(code), encodedLength);
        if (index > 0)
        {
            try
            {
                encode((UnsafeBuffer)ringBuffer.buffer(), index, captureLength, length, address);
            }
            finally
            {
                ringBuffer.commit(index);
            }
        }
    }
@Test
    void logAddress()
    {
        final int recordOffset = 64;
        logBuffer.putLong(CAPACITY + TAIL_POSITION_OFFSET, recordOffset);
        final DriverEventCode eventCode = NAME_RESOLUTION_NEIGHBOR_REMOVED;
        final int captureLength = 12;

        logger.logAddress(eventCode, new InetSocketAddress("localhost", 5656));

        verifyLogHeader(logBuffer, recordOffset, toEventCodeId(eventCode), captureLength, captureLength);
        assertEquals(5656, logBuffer.getInt(encodedMsgOffset(recordOffset + LOG_HEADER_LENGTH), LITTLE_ENDIAN));
        assertEquals(4, logBuffer.getInt(
            encodedMsgOffset(recordOffset + LOG_HEADER_LENGTH + SIZE_OF_INT), LITTLE_ENDIAN));
    }