powered by Jive Software

How to login as a anonymous user with Smack 4.2.1


#1

I am new to smack, I am trying to use smack 4.2.1 to connect the xmppserver(openfire).The code is login with a username and password,but when I try to modify the code.There is no loginAnonymous function.

 XMPPTCPConnectionConfiguration conf = XMPPTCPConnectionConfiguration.builder()
                 .setXmppDomain("404.city").setUsernameAndPassword("user", "password")
                 .setCompressionEnabled(false)
                 .setSecurityMode(ConnectionConfiguration.SecurityMode.required)        
                 .setCustomSSLContext(sslcont)
                 .build();
             XMPPTCPConnection connection = new XMPPTCPConnection(conf);
             if(connection.isConnected()){
                 System.out.println("already connected");
                 return;
             }

             connection.connect();
             connection.login();

How Can I Login as a anonymous?Please guide me