EntityImpl toEntity = EntityImpl.parse("userTo@vysper.org");
TestSessionContext sessionContext = TestSessionContext.createSessionContext(toEntity);
sessionContext.setSessionState(SessionState.AUTHENTICATED);
resourceRegistry.bindSession(sessionContext);
Stanza stanza = StanzaBuilder.createMessageStanza(fromEntity, toEntity, "en", "Hello").build();
try {
stanzaRelay.relay(toEntity, stanza, new IgnoreFailureStrategy());
Stanza recordedStanza = sessionContext.getNextRecordedResponse(1000);
assertNotNull("stanza delivered", recordedStanza);
assertEquals("Hello", recordedStanza.getSingleInnerElementsNamed("body").getSingleInnerText().getText());
} catch (DeliveryException e) {
throw e;
}
}