Smack disconnecting

I have a very simple chat-oracle using Smack. It connects, waits for question and answers them. It also spontaneously says things once in a while (don’t ask).

The problem is, it seems to spontaneously disconnect. It tries to send a packet and gets:

java.lang.IllegalStateException: Not connected to server.
at org.jivesoftware.smack.XMPPConnection.sendPacket(XMPPConnection.java:729)
at com.circuspop.common.SmackClient.send(SmackClient.java:30)

That’s the first symptom of the problem. It’s also the last – it never tries to reconnect and all subsequent sends meet the same fate.

Any ideas?