@Test
    public void testReplyErrorIfInfoMessageArrivesAfterDone() {
        MockComponents mc = createDefaultMock("id.user==1234");
        mc.visitorSession.start();
        mc.executor.expectAndProcessTasks(1);

        replyToCreateVisitor(mc.sender, ProgressToken.FINISHED_BUCKET);
        mc.executor.expectAndProcessTasks(1);

        mc.receiver.send(new VisitorInfoMessage());
        mc.executor.expectAndProcessTasks(1);
        // Should not be passed on to data handler
        assertEquals(0, mc.dataHandler.getMessages().size());

        assertEquals("VisitorReply(APP_FATAL_ERROR: Visitor has been shut down)\n",
                mc.receiver.repliesToString());
    }
Test that there is no race condition between a reply is handed off
to the executor service via a task (thus decrementing the pending count
for the sender) and the session checking for completion early, e.g.
because of an error transitioning it into a failure state.
documentapi/src/test/java/com/yahoo/documentapi/messagebus/MessageBusVisitorSessionTestCase.java