|| serverResource.equals(XMPPID.PATH_DELIMITER)) {
serverResource = getClientIdentifier();
jabberURI.setResourceName(serverResource);
}
try {
ConnectionConfiguration config;
if (hostnameOverride != null) {
config = new ConnectionConfiguration(hostnameOverride,
XMPP_DEFAULT_PORT, serviceName);
} else if (serverPort == -1) {
config = new ConnectionConfiguration(serviceName);
} else {
config = new ConnectionConfiguration(serviceName, serverPort);
}
config.setSendPresence(true);
// Handler is only used if server requires certificate for
// authentication; handler should provide keystore password:
if (callbackHandler instanceof javax.security.auth.callback.CallbackHandler) {
config.setCallbackHandler((javax.security.auth.callback.CallbackHandler) callbackHandler);
}
connection = new XMPPConnection(config);
connection.connect();
SASLAuthentication.supportSASLMechanism("PLAIN", 0);