use of org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration in project Smack by igniterealtime.
the class XmppTools method createAccount.
public static boolean createAccount(DomainBareJid xmppDomain, Localpart username, String password) throws KeyManagementException, NoSuchAlgorithmException, SmackException, IOException, XMPPException, InterruptedException {
XMPPTCPConnectionConfiguration.Builder configBuilder = XMPPTCPConnectionConfiguration.builder().setXmppDomain(xmppDomain);
TLSUtils.acceptAllCertificates(configBuilder);
XMPPTCPConnectionConfiguration config = configBuilder.build();
XMPPTCPConnection connection = new XMPPTCPConnection(config);
connection.connect();
try {
if (!supportsIbr(connection))
return false;
AccountManager accountManager = AccountManager.getInstance(connection);
accountManager.createAccount(username, password);
return true;
} finally {
connection.disconnect();
}
}
use of org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration in project Smack by igniterealtime.
the class XmppTools method supportsIbr.
public static boolean supportsIbr(DomainBareJid xmppDomain) throws SmackException, IOException, XMPPException, InterruptedException, KeyManagementException, NoSuchAlgorithmException {
XMPPTCPConnectionConfiguration.Builder configBuilder = XMPPTCPConnectionConfiguration.builder().setXmppDomain(xmppDomain);
TLSUtils.acceptAllCertificates(configBuilder);
XMPPTCPConnectionConfiguration config = configBuilder.build();
XMPPTCPConnection connection = new XMPPTCPConnection(config);
connection.connect();
try {
return supportsIbr(connection);
} finally {
connection.disconnect();
}
}
Aggregations