code: private HandshakeStatus writeRecord(EngineOutputRecord eor,
              EngineArgs ea) throws IOException {
  
          // eventually compress as well.
          HandshakeStatus hsStatus =
                  writer.writeRecord(eor, ea, writeMAC, writeCipher);
  
          /*
           * We only need to check the sequence number state for
           * non-handshaking record.
           *
           * Note that in order to maintain the handshake status
           * properly, we check the sequence number after the last
           * record writing process. As we request renegotiation
           * or close the connection for wrapped sequence number
           * when there is enough sequence number space left to
           * handle a few more records, so the sequence number
           * of the last record cannot be wrapped.
           */
          if (connectionState < cs_ERROR && !isOutboundDone() &&
                  (hsStatus == HandshakeStatus.NOT_HANDSHAKING)) {
              if (checkSequenceNumber(writeMAC, eor.contentType())) {
                  hsStatus = getHSStatus(null);
              }
          }
  
          /*
           * turn off the flag of the first application record if we really
           * consumed at least byte.
           */
          if (isFirstAppOutputRecord && ea.deltaApp() > 0) {
              isFirstAppOutputRecord = false;
          }
  
          return hsStatus;
      }
docs: /*
  Central point to write/get all of the outgoing data.