@Test
    void testSetNodeState() throws Exception {
        Set<Integer> nodeIndexes = new TreeSet<>(List.of(4, 6, 9, 10, 14, 16, 21, 22, 23, 25));
        Set<ConfiguredNode> configuredNodes = nodeIndexes.stream().map(i -> new ConfiguredNode(i, false)).collect(Collectors.toSet());
        FleetControllerOptions.Builder options = defaultOptions(configuredNodes);
        //options.setStorageDistribution(new Distribution(getDistConfig(nodeIndexes)));
        setUpFleetController(timer, options);
        setUpVdsNodes(timer, false, nodeIndexes);
        waitForState("version:\\d+ distributor:26 .0.s:d .1.s:d .2.s:d .3.s:d .5.s:d .7.s:d .8.s:d .11.s:d .12.s:d .13.s:d .15.s:d .17.s:d .18.s:d .19.s:d .20.s:d .24.s:d storage:26 .0.s:d .1.s:d .2.s:d .3.s:d .5.s:d .7.s:d .8.s:d .11.s:d .12.s:d .13.s:d .15.s:d .17.s:d .18.s:d .19.s:d .20.s:d .24.s:d");

        int rpcPort = fleetController().getRpcPort();
        Target connection = supervisor.connect(new Spec("localhost", rpcPort));
        assertTrue(connection.isValid());

        Request req = setNodeState("storage/cluster.mycluster/storage/14", "s:r", connection);
        assertEquals(ErrorCode.NONE, req.errorCode(), req.toString());
        assertTrue(req.checkReturnTypes("s"), req.toString());

        waitForState("version:\\d+ distributor:26 .* storage:26 .* .14.s:r .*");

        req = setNodeState("storage/cluster.mycluster/storage/16", "s:m", connection);
        assertEquals(ErrorCode.NONE, req.errorCode(), req.toString());
        assertTrue(req.checkReturnTypes("s"), req.toString());

        waitForState("version:\\d+ distributor:26 .* storage:26 .* .14.s:r.* .16.s:m .*");
        nodes.get(5 * 2 + 1).disconnect();
        waitForCompleteCycle();
        timer.advanceTime(100000000);
        waitForCompleteCycle();
        assertEquals(State.MAINTENANCE, fleetController().getSystemState().getNodeState(new Node(NodeType.STORAGE, 16)).getState());

        nodes.get(4 * 2 + 1).disconnect();
        waitForState("version:\\d+ distributor:26 .* storage:26 .* .14.s:m.* .16.s:m .*");
        nodes.get(4 * 2 + 1).connect();
        timer.advanceTime(100000000);
        // Might need to pass more actual time while waiting below?
        waitForState("version:\\d+ distributor:26 .* storage:26 .* .14.s:r.* .16.s:m .*");
    }
Note: RpcServer is only used in unit tests

@author humbe
clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/RpcServerTest.java