Android :Not connected to server

I got this errro message when I leave the MUC room on the android platform.

java.lang.IllegalStateException: Not connected to server.

at org.jivesoftware.smack.XMPPConnection.sendPacket(XMPPConnection.java:445)

at org.jivesoftware.smackx.muc.MultiUserChat.leave(MultiUserChat.java:534)

It works for sometime but sometime hava above message.

Your help is greatly appreciated.