@Override
	public void messageReceived(ChannelHandlerContext ctx, MessageEvent event) throws Exception {
		if (!(event.getMessage() instanceof Frame)) {
			LOGGER.error("Not a frame... {}", event.getMessage());
			return;
		}
		Channel channel = ctx.getChannel();
		Frame frame = (Frame) event.getMessage();
		LOGGER.trace("Received frame from {} : {}", channel.getRemoteAddress(), frame);

		// CONNECT
		if (frame.isCommand(COMMAND_CONNECT)) {
			try {
				handleConnect(channel, frame);
			} catch (RuntimeException e) {
				LOGGER.info("Login failed", e);
				disconnectClient(event.getChannel());
			}
		}
		// DISCONNECT
		else if (frame.isCommand(COMMAND_DISCONNECT)) {
			handleDisconnect(channel, frame);
			disconnectClient(event.getChannel());
		}
		// SUBSCRIBE
		else if (frame.isCommand(COMMAND_SUBSCRIBE)) {
			handleSubscribe(channel, frame);
		}
		// UNSUBSCRIBE
		else if (frame.isCommand(COMMAND_UNSUBSCRIBE)) {
			handleUnsubscribe(channel, frame);
		}
		// SEND
		else if (frame.isCommand(COMMAND_SEND)) {
			handleSend(channel, frame);
		}
		// ACK
		else if (frame.isCommand(COMMAND_ACK)) {
			handleAck(channel, frame);
		}
		// HEARTBEAT
		else if (frame.isCommand(COMMAND_HEARBEAT)) {
			handleHeartBeat(channel, frame);
		}
		// UNKNOWN
		else {
			handleUnknown(channel, frame);
		}
	}