code: private void validateOpcodeUsingFin(Opcode opcode, boolean fin) throws ProtocolDecoderException {
          switch (opcode) {
              case CONTINUATION:
                  if (prevDataFin) {
                      throw new ProtocolDecoderException("Not expecting CONTINUATION frame");
                  }
                  break;
  
              case TEXT:
              case BINARY:
                  if (!prevDataFin) {
                      throw new ProtocolDecoderException("Expecting CONTINUATION frame, but got "+opcode+" frame");
                  }
                  break;
  
              case PING:
              case PONG:
              case CLOSE:
                  if (!fin) {
                      throw new ProtocolDecoderException("Expected FIN for "+opcode+" frame");
                  }
                  break;
          default:
              break;
          }
      }
docs: Validates opcode w.r.t FIN bit