private String executeTask(String taskId) {
        // Prepare a request object.
        Request requestObject = new Request(tokenTS, taskId);

        // Prepare a request message.
        String request;
        try {
            // Attempt to serialize the request object into a string.
            request = serialize(requestObject);
        } catch (Exception e) {
            // If an error occurs, return it as a message.
            return "An error occured during serialization: " + e.getMessage();

        }

        // Try at most 3 times to perform the execution.
        for (int i = 1; i <= 2; i++) {
            // Transmit the request.
            outS.transmit(request);
            // Prepare a Receiver for the reply.
            Receiver<String> inS = outS.getReceiver();
            // Get a reply.
            String reply = inS.receive();
            // Do different actions depending of the contents of the reply.
            switch (reply.toLowerCase()) {
                case "success":
                    return "The task has been successfully executed.";
                case "failure":
                    return "The task can't be executed.";
                case "role-mismatch":
                    return "You don't have the permission to execute this task.";
                case "token-expired":
                    // The token has expired and must be renewed.
                    renewToken();
                    // Then try again.
                    continue;
                default:
                    // Reply not recognized, return as error.
                    return "Errort: " + reply;
            }
        }
        
        return "Error: Unable to execute task.";
    }