Smack method equivalent to aSmack setSASLAuthenticationEnabled

159 Views Asked by At

I am migrating from aSmack to the latest version of the Smack library in my Android project and I have this problem...the aSmack method setSASLAuthenticationEnabled does not exist in smack and now I cannot connect to the two servers where I work with (one of these requires SecurityMode.required and the other one SecurityMode.disabled).

This is my current code with smack...

    XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
                    .setHost(host.getHost())
                    .setPort(host.getPort())
                    .setXmppDomain(TDActivity.get_domainXMPP())
                    .setSecurityMode(SecurityMode.required)
                    .setCompressionEnabled(true)
                    .build();
            connectionXMPP = new XMPPTCPConnection(config);

This is the code with the old asmack that works correctly...

  AndroidConnectionConfiguration  config = new AndroidConnectionConfiguration (host.getFQDN(),host.getPort(),TDActivity.get_domainXMPP()); 
  config.setSASLAuthenticationEnabled(true); 
  config.setSecurityMode(SecurityMode.required); 
  config.setCompressionEnabled(true); 
  config.setReconnectionAllowed(false); 
  SmackConfiguration.setKeepAliveInterval(1000 * 5);    // 5 sec 
  SmackConfiguration.setPacketReplyTimeout(1000 * 10);    // 10 sec 

(In release server the certificates are updated, but in production them has expired. This is why it works on release and not in production. But the updating of the certificates does not depend on me, so I have to find a universal solution)

Cheers!

0

There are 0 best solutions below