    public static SameController create(int port) {
        ConnectionManagerImpl connections = new ConnectionManagerImpl(
                timeout, timeout);
        State state = new State("Default");
        Broadcaster broadcaster = BroadcasterImpl.getDefaultBroadcastRunner();
        MasterServiceImpl master = new MasterServiceImpl(state, connections,
                broadcaster);
        JsonRpcServer jsonMaster = new JsonRpcServer(master, MasterService.class);
        ClientServiceImpl client = new ClientServiceImpl(state, connections);
        JsonRpcServer jsonClient = new JsonRpcServer(client, ClientService.class);
        PaxosServiceImpl paxos = new PaxosServiceImpl("");
        JsonRpcServer jsonPaxos = new JsonRpcServer(paxos, PaxosService.class);
        Server server = new Server(port);
        SameController controller = new SameController(port, server, master, client,
                paxos);
        RpcHandler rpcHandler = new RpcHandler(null);
        rpcHandler.addRpcServer("/MasterService.json", jsonMaster);
        rpcHandler.addRpcServer("/ClientService.json", jsonClient);
        rpcHandler.addRpcServer("/PaxosService.json", jsonPaxos);
        server.setHandler(rpcHandler);
        return controller;
    }

    public static SameController create(int port) {
        ConnectionManagerImpl connections = new ConnectionManagerImpl(
                timeout, timeout);
        State state = new State("Default");
        Broadcaster broadcaster = BroadcasterImpl.getDefaultBroadcastRunner();
        MasterServiceImpl master = new MasterServiceImpl(state, connections,
                broadcaster);
        JsonRpcServer jsonMaster = new JsonRpcServer(master, MasterService.class);
        ClientServiceImpl client = new ClientServiceImpl(state, connections);
        JsonRpcServer jsonClient = new JsonRpcServer(client.getService(),
                ClientService.class);
        PaxosServiceImpl paxos = new PaxosServiceImpl("");
        JsonRpcServer jsonPaxos = new JsonRpcServer(paxos, PaxosService.class);
        Server server = new Server(port);
        SameController controller = new SameController(port, server, master, client,
                paxos);
        RpcHandler rpcHandler = new RpcHandler(null);
        rpcHandler.addRpcServer("/MasterService.json", jsonMaster);
        rpcHandler.addRpcServer("/ClientService.json", jsonClient);
        rpcHandler.addRpcServer("/PaxosService.json", jsonPaxos);
        server.setHandler(rpcHandler);
        return controller;
    }
