code: public DecodingState decode(IoBuffer in, ProtocolDecoderOutput out)
              throws Exception {
          boolean found = false;
          boolean finished = false;
          while (in.hasRemaining()) {
              byte b = in.get();
              if (!hasCR) {
                  if (b == CR) {
                      hasCR = true;
                  } else {
                      if (b == LF) {
                          found = true;
                      } else {
                          in.position(in.position() - 1);
                          found = false;
                      }
                      finished = true;
                      break;
                  }
              } else {
                  if (b == LF) {
                      found = true;
                      finished = true;
                      break;
                  }
                  
                  throw new ProtocolDecoderException(
                          "Expected LF after CR but was: " + (b & 0xff));
              }
          }
  
          if (finished) {
              hasCR = false;
              return finishDecode(found, out);
          }
          
          return this;
      }
docs: {@inheritDoc}