private void getMode(Request req) {
        dispatchRpcRequest(req, () -> {
            req.returnValues().add(new StringValue(proxyServer.getMode().name()));
            req.returnRequest();
        });
    }
@Test
    void testRpcMethodGetModeAndSetMode() {
        Request req = new Request("getMode");
        client.invoke(req);
        assertFalse(req.isError(), req.errorMessage());
        assertEquals(1, req.returnValues().size());
        assertEquals("default", req.returnValues().get(0).asString());

        req = new Request("setMode");
        String mode = "memorycache";
        req.parameters().add(new StringValue(mode));
        client.invoke(req);
        assertFalse(req.isError(), req.errorMessage());
        assertEquals(1, req.returnValues().size());
        String[] ret = req.returnValues().get(0).asStringArray();
        assertEquals(2, ret.length);
        assertEquals("0", ret[0]);
        assertEquals("success", ret[1]);
        assertEquals(mode, server.proxyServer().getMode().name());

        req = new Request("getMode");
        client.invoke(req);
        assertFalse(req.isError(), req.errorMessage());
        assertEquals(1, req.returnValues().size());
        assertEquals(mode, req.returnValues().get(0).asString());

        req = new Request("setMode");
        String oldMode = mode;
        mode = "invalid";
        req.parameters().add(new StringValue(mode));
        client.invoke(req);

        assertFalse(req.isError(), req.errorMessage());
        ret = req.returnValues().get(0).asStringArray();
        assertEquals(2, ret.length);
        assertEquals("1", ret[0]);
        assertEquals("Unrecognized mode '" + mode + "' supplied. Legal modes are '" + Mode.modes() + "'", ret[1]);
        assertEquals(oldMode, server.proxyServer().getMode().name());
    }