Index: src/test/java/org/apache/vysper/xmpp/protocol/ProtocolWorkerProcessTestCase.java =================================================================== --- src/test/java/org/apache/vysper/xmpp/protocol/ProtocolWorkerProcessTestCase.java (revision 768274) +++ src/test/java/org/apache/vysper/xmpp/protocol/ProtocolWorkerProcessTestCase.java (working copy) @@ -257,7 +257,7 @@ protocolWorker.processStanza(sessionContext.getServerRuntimeContext(), sessionContext, stanzaBuilder.getFinalStanza(), sessionStateHolder); Stanza recordedResponse = sessionContext.getNextRecordedResponse(); assertUnknownSenderError(recordedResponse); // not allowed, bare id without resource and two resources bound - sessionContext.write(null); // reset + sessionContext.reset(); // unbind second resource, leaving only one boolean noResourceRemains = sessionContext.getServerRuntimeContext().getResourceRegistry().unbindResource(secondBoundResource); @@ -269,7 +269,7 @@ stanzaBuilder.startInnerElement("query").addNamespaceAttribute("testNSURI").endInnerElement(); protocolWorker.processStanza(sessionContext.getServerRuntimeContext(), sessionContext, stanzaBuilder.getFinalStanza(), sessionStateHolder); stanzaHandler.assertHandlerCalled(); - sessionContext.write(null); // reset + sessionContext.reset(); // second resource is now invalid and cannot be used anymore in a full qualified entity stanzaBuilder = StanzaBuilder.createIQStanza(null, null, IQStanzaType.GET, "test"); Index: src/test/java/org/apache/vysper/xmpp/server/TestSessionContext.java =================================================================== --- src/test/java/org/apache/vysper/xmpp/server/TestSessionContext.java (revision 768274) +++ src/test/java/org/apache/vysper/xmpp/server/TestSessionContext.java (working copy) @@ -97,18 +97,19 @@ } /** - * @param stanza records the stanza. if NULL, the prev recorded stanza will be reset. - * @throws IllegalStateException if NOT NULL, and there is already a stanza recorded + * Resets all recorded stanzas and their count. */ + public void reset() { + recordedResponses.clear(); + recordedResponsesTotal = 0; + } + + /** + * @param stanza records the stanza. + */ public void write(Stanza stanza) { - if (stanza == null) { - recordedResponses.clear(); - recordedResponsesTotal = 0; - return; - } else { - recordedResponses.add(stanza); - recordedResponsesTotal++; - } + recordedResponses.add(stanza); + recordedResponsesTotal++; } public void setSessionState(SessionState sessionState) {