I am writing a library to connect to a Jabberd2 server and perform basic operations like presence-lookup, new friend request, etc. The admin user logs into the Jabberd2 server using Smack and performs these operations. What I have observed is that when I run any particular operation individually (or if I debug), all the operations are carried out successfully. But, when I run them in a unit test one after the other, I get the following error randomly for certain operations -
Authentication failed.:
at org.jivesoftware.smack.NonSASLAuthentication.authenticate(NonSASLAuthentication .java:91)
at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:345)
at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:301)
at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:283)
I suspect this is a threading issue, but I believe that Smack takes care of threading internally.
Any suggestions for solving this problem would be greatly appreciated, 've been stuck at this for over a week now.
Thanks,
Neha.