public void stopServer() {
        if (started) {
            try {
                server.stop();
                started = false;
            } catch (Exception e) {
                throw new RuntimeException("Could not stop server", e);
            }
        }
    }