The authentification should use the Connection#sendPacket method and work transparent with packets and packet listeners.
Additional Patch http://www.igniterealtime.org/community/message/185164#185164 should be compared or used for verification
added second patch
This Patch was commited to the community patch repository
Fixed for trunk version on revision 11256.
I fixed it with my own patch, because working directly with the XMPPConnection#writer conflict with further development with other connection types (like http-bind SMACK-187).
Where I can get 3.1.1 version? I expreience this problem on server jabber.ru.
3.1.1 is not yet released. So, you can only try to build it fro the sources yourself.