@Test
    public void testMaxPendingVisitorsForSender() {
        MockSender sender = new MockSender();
        MockReceiver receiver = new MockReceiver();
        sender.setMaxPending(1);
        MockAsyncTaskExecutor executor = new MockAsyncTaskExecutor();
        // Visit-all will normally start with 1 distribution bit and send
        // to 2 superbuckets if allowed to do so.
        VisitorParameters params = createVisitorParameters("");
        MessageBusVisitorSession visitorSession = createVisitorSession(
                sender, receiver, executor, params);

        visitorSession.start();
        executor.expectAndProcessTasks(1);
        assertEquals("CreateVisitorMessage(buckets=[\n" +
                "BucketId(0x0400000000000000)\n" +
                "BucketId(0x0000000000000000)\n" +
                "]\n)",
                replyToCreateVisitor(sender, ProgressToken.FINISHED_BUCKET));
        executor.expectAndProcessTasks(1); // Reply
        executor.expectAndProcessTasks(1); // New visitor

        assertEquals("CreateVisitorMessage(buckets=[\n" +
                "BucketId(0x0400000000000001)\n" +
                "BucketId(0x0000000000000000)\n" +
                "]\n)",
                replyToCreateVisitor(sender, ProgressToken.FINISHED_BUCKET));
    }
Test that using an id.user=foo selection only tries to visit a single
superbucket for that user.
documentapi/src/test/java/com/yahoo/documentapi/messagebus/MessageBusVisitorSessionTestCase.java