I found two concurrency issues in the IM Gateway plugin.
The first is quite easy to fix. In the SessionManager class a HashMap is used to store sessions. The SessionReaper periodically goes over the values in this map. However, if a change to the map (e.g. a new session is created) is made when the SessionReaper is iterating through the values a ConcurrentModificationException will be thrown causing the Timer thread to die. This can easily be solved by changing the type of the map to ConcurrentHashMap.
The second issue will be a bit harder to fix. When two resources of a user come online at the same time, two sessions are created, but only one is kept in the session map mentioned above (the first is overwritten). This can cause very strange behaviour, like people staying logged in to a network while they are no longer online, receiving “you have been disconnected from msn” messages whie you actually still remain logged in, people chatting to you, but you cannot chat back etc.
I think creating sessions should be synchronized in some way, preferrably per XMPP user. I have created a workaround which achieves this, but I would prefer not to share it here, because it violates some rules of good programming practice ;). In order to keep the impact of this synchronization as low as possible all initialization done for a session class should probably be moved out of the constuctor.
Hope this helps.