docs: public Msg read()
      {
          if (!inActive) {
              return null;
          }
          if (state != State.ACTIVE && state != State.WAITING_FOR_DELIMITER) {
              return null;
          }
  
          while (true) {
              Msg msg = inpipe.read();
  
              if (msg == null) {
                  inActive = false;
                  return null;
              }
  
              //  If this is a credential, save a copy and receive next message.
              if (msg.isCredential()) {
                  credential = Blob.createBlob(msg);
                  continue;
              }
  
              //  If delimiter was read, start termination process of the pipe.
              if (msg.isDelimiter()) {
                  processDelimiter();
                  return null;
              }
  
              if (!msg.hasMore() && !msg.isIdentity()) {
                  msgsRead++;
              }
  
              if (lwm > 0 && msgsRead % lwm == 0) {
                  sendActivateWrite(peer, msgsRead);
              }
              return msg;
          }
      }