This bug is specific to unit testing with a session, where stanzas are being sent.
When a handler gets tested, the handler sends out stanzas and the test keeps track of them, by looking them up and inspecting them. Handlers can send stanzas via the StanzaRelayBroker (to any receiver), by returning them as a handler's result to the calling session's client or by directly putting them on the wire of some active session using LocalDeliveryUtils.relayToResourceDirectly(). The test env is not currently set up to deal with more than one stanza send in the latter way. When the second stanza gets sent, the ISE is raised.
A proper solution would be to refactor TestSessionContext.write() to be able to receive (and inspect) more than one stanza.