SMACK librarary with many clients throws error


I am developing a test tool using smack which does

1)Connects a big number of users to openfire server ~400

2)Every users has two timers a) reconnection timer and

b)presence change timer.

These two timers are continously scheduled.

On reconnection timer expiry I do disconnect and reconnect and login the user.

On Presence change timer expiry i do change the presence of that user.

It runs good and fine but after some times i get :

stream:error (conflict)

at org.jivesoftware.smack.PacketReader.parsePackets(

at org.jivesoftware.smack.PacketReader.access$000(

at org.jivesoftware.smack.PacketReader$

Below is the code snipped

onTimerExpiry() {

if (connection != null && connection.isConnected()) {



if (connection != null) {


connection.login(userName, password, “staticResource”);



I understand that this happens because the same user is trying to connect again with the same resource, but i do disconnect() before connecting again. The XMPP server which I am using for this test is openfire 3.6.4

Is it the case that even though i call disconnect() it takes some time to actually disconnect() the user and connecting quickly raises this exception.

Please help me in nailing down the problem.

Thanks in advance,