@Override
	public Message decode(ByteBuffer buffer) {
		Message message = null;
		switch (getSession().getState()) {
		case CONNECTED:
			message = handleServiceRequest(buffer);
			break;
		case UPDATING:
			message = updateDecoder.decode(buffer);
			break;
		case LOGGING_IN:
			message = loginDecoder.decode(buffer);
			break;
		case LOGGED_IN:
			message = messageDecoder.decode(buffer);
			break;
		}
		if (message != null) {
			message.setSession(getSession());
		}
		return message;
	}