src/main/java/org/jivesoftware/smack/XMPPConnection.java
public void connect() throws XMPPException {
        // Establishes the connection, readers and writers
        connectUsingConfiguration(config);
        // Automatically makes the login if the user was previously connected
        // successfully
        // to the server and the connection was terminated abruptly
        if (connected && wasAuthenticated) {
            // Make the login
            if (isAnonymous()) {
                // Make the anonymous login
                loginAnonymously();
            } else {
                login(config.getUsername(), config.getPassword(),
                        config.getResource());
            }
            notifyReconnection();
        }
    }
public void connect() throws XMPPException {
        // Establishes the connection, readers and writers
        connectUsingConfiguration(config);
        // Automatically makes the login if the user was previously connected
        // successfully
        // to the server and the connection was terminated abruptly
        if (connected && wasAuthenticated) {
            // Make the login
            if (isAnonymous()) {
                // Make the anonymous login
                loginAnonymously();
            } else {
                login(config.getUsername(), config.getPassword(),
                        config.getResource());
            }
            notifyReconnection();
        }
    }
Establishes a connection to the XMPP server and performs an automatic
login only if the previous connection state was logged (authenticated).
It basically creates and maintains a socket connection to the server.
<p>
<p/>
Listeners will be preserved from a previous connection if the
reconnection occurs after an abrupt termination.

@throws XMPPException
if an error occurs while trying to establish the connection.
Two possible errors can occur which will be wrapped by an
XMPPException -- UnknownHostException (XMPP error code 504),
and IOException (XMPP error code 502). The error codes and
wrapped exceptions can be used to present more appropriate
error messages to end-users.