示例#1
0
  // BEGIN implementation of BouncyCastleTlsNotificationListener
  @Override
  public void notifyAlertRaised(
      short alertLevel, short alertDescription, String message, Throwable cause) {
    String logMessage =
        "TLS server raised alert: "
            + AlertLevel.getText(alertLevel)
            + ", "
            + AlertDescription.getText(alertDescription);
    if (message != null) {
      logMessage += " > " + message;
    }
    if (cause != null) {
      logMessage += " " + cause.toString();
    }
    logger.logState(logMessage);

    // TODO hack to suppress error TLS messages
    if (alertLevel == AlertLevel.fatal
        && alertDescription == AlertDescription.internal_error
        && "Failed to read record".equals(message)
        && cause instanceof java.io.EOFException) {
      doSuppressTLSErrors = true;
    }

    // close HTTP connections if TLS channel is closed
    if (alertLevel == AlertLevel.warning && alertDescription == AlertDescription.close_notify) {
      closeAllConnections();
    }
  }
示例#2
0
 @Override
 public void notifyAlertReceived(short alertLevel, short alertDescription) {
   logger.logState(
       "TLS server received alert: "
           + AlertLevel.getText(alertLevel)
           + ", "
           + AlertDescription.getText(alertDescription));
 }