}
}
private void connect(String servername, String adminUsername, String adminPassword, String nodeId) {
try {
ConnectionConfiguration conConfig = new ConnectionConfiguration(servername, 5222);
conConfig.setNotMatchingDomainCheckEnabled(false);
conConfig.setSASLAuthenticationEnabled(false);
//the admin reconnects automatically upon server restart or failure but *not* on a resource conflict and a manual close of the connection
conConfig.setReconnectionAllowed(true);
//conConfig.setDebuggerEnabled(true);
if (connection == null || !connection.isAuthenticated()) {
connection = new XMPPConnection(conConfig);
connection.connect();
connection.addConnectionListener(new ConnectionListener() {