private String generateReply(String message) {

        String[] s = message.split("\\s+");
        String reply = message.replaceFirst(s[0], " ").trim();

        switch (s[0]) {
            case ("LOWERCASE"):
                reply = reply.toLowerCase();
                break;
            case ("UPPERCASE"):
                reply = reply.toUpperCase();
                break;
            case ("REVERSE"):
                reply = new StringBuffer(reply).reverse().toString();
                break;
            case ("BYE"):
                reply = "BYE";
                makeChat = false;
                break;
            case ("SHUTDOWN"):
                if (s.length > 1 && Server.PASSWORD.startsWith(s[1])) {
                    reply = "OK_BYE";
                    makeChat = false;
                    server.close();
                    break;
                }
            default:
                reply = "ERROR " + message;
                break;
        }
        return reply;
    }