public int doWork()
    {
        final long nowNs = nanoClock.nanoTime();
        cachedNanoClock.update(nowNs);
        dutyCycleTracker.measureAndUpdate(nowNs);

        final int workCount = commandQueue.drain(CommandProxy.RUN_TASK, Configuration.COMMAND_DRAIN_LIMIT);

        final long shortSendsBefore = shortSends.get();
        final int bytesSent = doSend(nowNs);
        int bytesReceived = 0;

        if (0 == bytesSent ||
            ++dutyCycleCounter >= dutyCycleRatio ||
            (controlPollDeadlineNs - nowNs < 0) ||
            shortSendsBefore < shortSends.get())
        {
            bytesReceived = controlTransportPoller.pollTransports();

            dutyCycleCounter = 0;
            controlPollDeadlineNs = nowNs + statusMessageReadTimeoutNs;
        }

        if (reResolutionCheckIntervalNs > 0 && (reResolutionDeadlineNs - nowNs) < 0)
        {
            reResolutionDeadlineNs = nowNs + reResolutionCheckIntervalNs;
            controlTransportPoller.checkForReResolutions(nowNs, conductorProxy);
        }

        return workCount + bytesSent + bytesReceived;
    }
@Test
    void shouldSendMultipleSetupFramesOnChannelWhenTimeoutWithoutStatusMessage()
    {
        sender.doWork();
        assertThat(receivedFrames.size(), is(1));

        nanoClock.advance(Configuration.PUBLICATION_SETUP_TIMEOUT_NS - 1);
        sender.doWork();

        nanoClock.advance(10);
        sender.doWork();

        assertThat(receivedFrames.size(), is(2));
    }