Change default resource while loginAnonymously


I want to change default resource ‘smack’ to my custom resource name using smack library whille login as a Anonymously .

I can do when i login with specific username,password as show below

connection.login(username, password, “resourcename”);

but how can i do the same from



That should be possible in the upcoming Smack version, 4.2, with ConnectionConfiguration.performSaslAnonymousAuthentication() and setResource().