RelayResult relayResult = new RelayResult();
for (SessionContext sessionContext : receivingSessions) {
if (sessionContext.getState() != SessionState.AUTHENTICATED) {
relayResult.addProcessingError(new DeliveryException("no relay to non-authenticated sessions"));
continue;
}
try {
StanzaHandler stanzaHandler = sessionContext.getServerRuntimeContext().getHandler(stanza);
INBOUND_STANZA_PROTOCOL_WORKER.processStanza(sessionContext, sessionStateHolder, stanza,
stanzaHandler);
} catch (Exception e) {
relayResult.addProcessingError(new DeliveryException(e));
}
}
return relayResult; // return success result
}