code: private void readMessage() throws IOException {
      while (true) {
        if (closed) throw new IOException("closed");
  
        if (frameLength > 0) {
          source.readFully(messageFrameBuffer, frameLength);
  
          if (!isClient) {
            messageFrameBuffer.readAndWriteUnsafe(maskCursor);
            maskCursor.seek(messageFrameBuffer.size() - frameLength);
            toggleMask(maskCursor, maskKey);
            maskCursor.close();
          }
        }
  
        if (isFinalFrame) break; // We are exhausted and have no continuations.
  
        readUntilNonControlFrame();
        if (opcode != OPCODE_CONTINUATION) {
          throw new ProtocolException("Expected continuation opcode. Got: " + toHexString(opcode));
        }
      }
    }
docs: Reads a message body into across one or more frames. Control frames that occur between
  fragments will be processed. If the message payload is masked this will unmask as it's being
  processed.