/** * Process the incoming message, calling the session decoder. As the * incoming buffer might contains more than one messages, we have to loop * until the decoder throws an exception. <code> * while ( buffer not empty ) * try * decode ( buffer ) * catch * break; * </code> */ @SuppressWarnings("unchecked") @Override public void messageReceived(IoSession session, Object in, ReadFilterChainController controller) { LOGGER.debug("Processing a MESSAGE_RECEIVED for session {}", session); DECODING_STATE state = getDecodingState(session); // Loop until the decoder cannot decode more MESSAGE msg; try { while (((msg = decoder.decode((ENCODED) in, state)) != null)) { super.messageReceived(session, msg, controller); } } catch (ProtocolDecoderException e) { LOGGER.debug("decoding exception : ", e); throw e; } }