code: private boolean checkSequenceNumber(MAC mac, byte type)
              throws IOException {
  
          /*
           * Don't bother to check the sequence number for error or
           * closed connections, or NULL MAC
           */
          if (connectionState >= cs_ERROR || mac == MAC.NULL) {
              return false;
          }
  
          /*
           * Conservatively, close the connection immediately when the
           * sequence number is close to overflow
           */
          if (mac.seqNumOverflow()) {
              /*
               * TLS protocols do not define a error alert for sequence
               * number overflow. We use handshake_failure error alert
               * for handshaking and bad_record_mac for other records.
               */
              if (debug != null && Debug.isOn("ssl")) {
                  System.out.println(threadName() +
                      ", sequence number extremely close to overflow " +
                      "(2^64-1 packets). Closing connection.");
              }
  
              fatal(Alerts.alert_handshake_failure, "sequence number overflow");
  
              return true; // make the compiler happy
          }
  
          /*
           * Ask for renegotiation when need to renew sequence number.
           *
           * Don't bother to kickstart the renegotiation when the local is
           * asking for it.
           */
          if ((type != Record.ct_handshake) && mac.seqNumIsHuge()) {
              if (debug != null && Debug.isOn("ssl")) {
                  System.out.println(threadName() + ", request renegotiation " +
                          "to avoid sequence number overflow");
              }
  
              beginHandshake();
              return true;
          }
  
          return false;
      }
docs: Check the sequence number state
  
  RFC 4346 states that, "Sequence numbers are of type uint64 and
  may not exceed 2^64-1.  Sequence numbers do not wrap. If a TLS
  implementation would need to wrap a sequence number, it must
  renegotiate instead."
  
  Return true if the handshake status may be changed.