public long removeSubscription(final long registrationId)
    {
        final long correlationId = toDriverCommandBuffer.nextCorrelationId();
        final int index = toDriverCommandBuffer.tryClaim(REMOVE_SUBSCRIPTION, RemoveMessageFlyweight.length());
        if (index < 0)
        {
            throw new AeronException("could not write remove subscription command");
        }

        removeMessage
            .wrap(toDriverCommandBuffer.buffer(), index)
            .registrationId(registrationId)
            .clientId(clientId)
            .correlationId(correlationId);

        toDriverCommandBuffer.commit(index);

        return correlationId;
    }
@Test
    void threadSendsRemoveSubscriberMessage()
    {
        conductor.removeSubscription(CORRELATION_ID);

        assertReadsOneMessage(
            (msgTypeId, buffer, index, length) ->
            {
                final RemoveMessageFlyweight removeMessage = new RemoveMessageFlyweight();
                removeMessage.wrap(buffer, index);

                assertEquals(REMOVE_SUBSCRIPTION, msgTypeId);
                assertEquals(CORRELATION_ID, removeMessage.registrationId());
            }
        );
    }