code: public void decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out)
              throws Exception {
          if (this.session == null) {
              this.session = session;
          } else if (this.session != session) {
              throw new IllegalStateException(
                      getClass().getSimpleName() + " is a stateful decoder.  " +
                  "You have to create one per session.");
          }
  
          undecodedBuffers.offer(in);
          for (;;) {
              IoBuffer b = undecodedBuffers.peek();
              if (b == null) {
                  break;
              }
  
              int oldRemaining = b.remaining();
              state.decode(b, out);
              int newRemaining = b.remaining();
              if (newRemaining != 0) {
                  if (oldRemaining == newRemaining) {
                      throw new IllegalStateException(
                              DecodingState.class.getSimpleName() + " must " +
                              "consume at least one byte per decode().");
                  }
              } else {
                  undecodedBuffers.poll();
              }
          }
      }
docs: {@inheritDoc}