code: private void recvAlert() throws IOException {
          byte level = (byte)inputRecord.read();
          byte description = (byte)inputRecord.read();
          if (description == -1) { // check for short message
              fatal(Alerts.alert_illegal_parameter, "Short alert message");
          }
  
          if (debug != null && (Debug.isOn("record") ||
                  Debug.isOn("handshake"))) {
              synchronized (System.out) {
                  System.out.print(threadName());
                  System.out.print(", RECV " + protocolVersion + " ALERT:  ");
                  if (level == Alerts.alert_fatal) {
                      System.out.print("fatal, ");
                  } else if (level == Alerts.alert_warning) {
                      System.out.print("warning, ");
                  } else {
                      System.out.print("<level " + (0x0ff & level) + ">, ");
                  }
                  System.out.println(Alerts.alertDescription(description));
              }
          }
  
          if (level == Alerts.alert_warning) {
              if (description == Alerts.alert_close_notify) {
                  if (connectionState == cs_HANDSHAKE) {
                      fatal(Alerts.alert_unexpected_message,
                                  "Received close_notify during handshake");
                  } else {
                      recvCN = true;
                      closeInboundInternal();  // reply to close
                  }
              } else {
  
                  //
                  // The other legal warnings relate to certificates,
                  // e.g. no_certificate, bad_certificate, etc; these
                  // are important to the handshaking code, which can
                  // also handle illegal protocol alerts if needed.
                  //
                  if (handshaker != null) {
                      handshaker.handshakeAlert(description);
                  }
              }
          } else { // fatal or unknown level
              String reason = "Received fatal alert: "
                  + Alerts.alertDescription(description);
              if (closeReason == null) {
                  closeReason = Alerts.getSSLException(description, reason);
              }
              fatal(Alerts.alert_unexpected_message, reason);
          }
      }
docs: /*
  Process an incoming alert ... caller must already have synchronized
  access to "this".