@Test
    void testGetSystemState() throws Exception {
        LogFormatter.initializeLogging();
        FleetControllerOptions.Builder options = defaultOptions();
        setUpFleetController(timer, options);
        setUpVdsNodes(timer);
        waitForStableSystem();

        assertTrue(nodes.get(0).isDistributor());
        log.log(Level.INFO, "Disconnecting distributor 0. Waiting for state to reflect change.");
        nodes.get(0).disconnect();
        nodes.get(19).disconnect();
        fleetController().waitForNodesInSlobrok(9, 9, timeout());
        timer.advanceTime(options.nodeStateRequestTimeoutMS() + options.maxSlobrokDisconnectGracePeriod());

        wait(new WaitCondition.StateWait(fleetController(), fleetController().getMonitor()) {
                 @Override
                 public String isConditionMet() {
                     if (currentState == null) {
                         return "No cluster state defined yet";
                     }
                     NodeState distState = currentState.getNodeState(new Node(NodeType.DISTRIBUTOR, 0));
                     if (distState.getState() != State.DOWN) {
                         return "Distributor not detected down yet: " + currentState.toString();
                     }
                     NodeState storState = currentState.getNodeState(new Node(NodeType.STORAGE, 9));
                     if (!storState.getState().oneOf("md")) {
                         return "Storage node not detected down yet: " + currentState.toString();
                     }
                     return null;
                 }
             }, new WaitTask() {
                 @Override
                 public boolean performWaitTask() {
                     return false;
                 }
             },
             timeout());

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

        Request req = new Request("getSystemState");
        connection.invokeSync(req, timeout());
        assertEquals(ErrorCode.NONE, req.errorCode(), req.toString());
        assertTrue(req.checkReturnTypes("ss"), req.toString());
        String systemState = req.returnValues().get(1).asString();
        ClusterState retrievedClusterState = new ClusterState(systemState);
        assertEquals(State.DOWN, retrievedClusterState.getNodeState(new Node(NodeType.DISTRIBUTOR, 0)).getState(), systemState);
        assertTrue(retrievedClusterState.getNodeState(new Node(NodeType.STORAGE, 9)).getState().oneOf("md"), systemState);
    }
Note: RpcServer is only used in unit tests

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