code: protected final void notifyConnectionError(final Exception exception) {
          if (!isConnected()) {
              LOGGER.log(Level.INFO, "Connection was already disconnected when attempting to handle " + exception,
                              exception);
              return;
          }
  
          ASYNC_BUT_ORDERED.performAsyncButOrdered(this, () -> {
              currentConnectionException = exception;
  
              for (StanzaCollector collector : collectors) {
                  collector.notifyConnectionError(exception);
              }
              SmackWrappedException smackWrappedException = new SmackWrappedException(exception);
              tlsHandled.reportGenericFailure(smackWrappedException);
              saslFeatureReceived.reportGenericFailure(smackWrappedException);
              lastFeaturesReceived.reportGenericFailure(smackWrappedException);
              // TODO From XMPPTCPConnection. Was called in Smack 4.3 where notifyConnectionError() was part of
              // XMPPTCPConnection. Create delegation method?
              // maybeCompressFeaturesReceived.reportGenericFailure(smackWrappedException);
  
              synchronized (AbstractXMPPConnection.this) {
                  notifyAll();
  
                  // Closes the connection temporary. A if the connection supports stream management, then a reconnection is
                  // possible. Note that a connection listener of e.g. XMPPTCPConnection will drop the SM state in
                  // case the Exception is a StreamErrorException.
                  instantShutdown();
              }
  
              Async.go(() -> {
                  // Notify connection listeners of the error.
                  callConnectionClosedOnErrorListener(exception);
              }, AbstractXMPPConnection.this + " callConnectionClosedOnErrorListener()");
          });
      }
docs: Sends out a notification that there was an error with the connection
  and closes the connection.
  
  @param exception the exception that causes the connection close event.