public static Type valueOf(int aCode) {
            switch (aCode) {
                case 0: return DISCONNECT;
                case 1: return CONNECT;
                case 2: return HEARTBEAT;
                case 3: return MESSAGE;
                case 4: return JSON_MESSAGE;
                case 5: return EVENT;
                case 6: return ACK;
                case 7: return ERROR;
                case 8: return NOOP;

                default:
                    return UNKNOWN;
            }
        }