private void installConnectionListeners(final XMPPConnection connection) {
        if (connection != null) {
            connectionListener = new AbstractConnectionClosedListener() {
                @Override
                public void connectionTerminated() {
                    unregisterInstanceFor(connection);
                }
            };
            connection.addConnectionListener(connectionListener);
        }
    }
private void installConnectionListeners ( final XMPPConnection connection ) { if ( connection != null ) { connectionListener = new AbstractConnectionClosedListener ( ) { @ Override public void connectionTerminated ( ) { unregisterInstanceFor ( connection ) ; } } ; connection . addConnectionListener ( connectionListener ) ; } }
Configure a session, setting some action listeners...

@param connection
The connection to set up