@Test
    public void testNoLocalDataHandlerGetNext() throws Exception {
        MockSender sender = new MockSender();
        MockReceiver receiver = new MockReceiver();
        MockAsyncTaskExecutor executor = new MockAsyncTaskExecutor();
        VisitorParameters params = createVisitorParameters("");
        params.setRemoteDataHandler("the/moon");
        MessageBusVisitorSession visitorSession = createVisitorSession(
                sender, receiver, executor, params);

        visitorSession.start();
        executor.expectAndProcessTasks(1);

        try {
            assertNotNull(visitorSession.getNext());
            fail("No exception thrown on getNext()");
        } catch (IllegalStateException e) {
            assertEquals("Data has been routed to external source for this visitor", e.getMessage());
        }
        try {
            assertNotNull(visitorSession.getNext(1234));
            fail("No exception thrown on getNext(int)");
        } catch (IllegalStateException e) {
            assertEquals("Data has been routed to external source for this visitor", e.getMessage());
        }
    }
Test that waitUntilDone on the session is forwarded to the control handler.
documentapi/src/test/java/com/yahoo/documentapi/messagebus/MessageBusVisitorSessionTestCase.java