src/main/java/org/jivesoftware/smack/XMPPConnection.java
synchronized void notifyConnectionError(Exception e) {
        // Listeners were already notified of the exception, return right here.
        if ((packetReader == null || packetReader.done)
                && (packetWriter == null || packetWriter.done))
            return;

        if (packetReader != null)
            packetReader.done = true;
        if (packetWriter != null)
            packetWriter.done = true;
        // Closes the connection temporary. A reconnection is possible
        shutdown(new Presence(Presence.Type.unavailable));
        // Notify connection listeners of the error.
        for (ConnectionListener listener : getConnectionListeners()) {
            try {
                listener.connectionClosedOnError(e);
            } catch (Exception e2) {
                // Catch and print any exception so we can recover
                // from a faulty listener
                e2.printStackTrace();
            }
        }
    }
synchronized void notifyConnectionError(Exception e) {
        // Listeners were already notified of the exception, return right here.
        if ((packetReader == null || packetReader.done)
                && (packetWriter == null || packetWriter.done))
            return;

        if (packetReader != null)
            packetReader.done = true;
        if (packetWriter != null)
            packetWriter.done = true;
        // Closes the connection temporary. A reconnection is possible
        shutdown(new Presence(Presence.Type.unavailable));
        // Notify connection listeners of the error.
        for (ConnectionListener listener : getConnectionListeners()) {
            try {
                listener.connectionClosedOnError(e);
            } catch (Exception e2) {
                // Catch and print any exception so we can recover
                // from a faulty listener
                e2.printStackTrace();
            }
        }
    }
Sends out a notification that there was an error with the connection and
closes the connection. Also prints the stack trace of the given exception

@param e
the exception that causes the connection close event.