ReconnectionManager is actually enabled by default, and as far as I can see is not meant to be used exclicitly (the constructor is private).
If you’d like to verify that it’s actually working, or e.g. do something upon reconnection, you might add a custom ConnectionListener to your XMPPConnection like this:
connection.addConnectionListener(new ConnectionListener() { @Override
public void reconnectionSuccessful() {
logger.info("Successfully reconnected to the XMPP server.");
}
@Override
public void reconnectionFailed(Exception arg0) {
logger.info("Failed to reconnect to the XMPP server.");
} @Override
public void reconnectingIn(int seconds) {
logger.info("Reconnecting in " + seconds + " seconds.");
}
@Override
public void connectionClosedOnError(Exception arg0) {
logger.error("Connection to XMPP server was lost.");
}
@Override
public void connectionClosed() {
logger.info("XMPP connection was closed.");
}
});