private void respondToRequest(Request request) {
        if (request.getCommand().equals("rebind")) {
            System.out.println(String.format("handling request %s from %s:%d", request, request.getHost(), request.getPort()));
            Reference reference = new Reference(request.getHost(), request.getPort());
            this.globalNameService.rebind(request.getHandle(), reference);
            writeToSocket(String.format("success!%s", request.getHandle()));
        }

        if (request.getCommand().equals("resolve")) {
            System.out.println(String.format("handling request %s", request));
            Reference reference = this.globalNameService.resolve(request.getHandle());
            if (reference != null)
                writeToSocket(String.format("success!%s", reference));
            else
                writeToSocket("error!handle_not_found");
        }
    }