assertEquals(map.iterator().next(), unrelatedUser.getEntityFQ());
Stanza directedPresence = unrelatedUser.getNextStanza();
assertNotNull(directedPresence);
assertTrue(PresenceStanza.isOfType(directedPresence)); // is presence
PresenceStanza presenceStanza = new PresenceStanza(directedPresence);
assertEquals(initiatingUser.getEntityFQ(), presenceStanza.getFrom());
resetRecordedStanzas(); // purge recorded
// directed unavailable presence
XMPPCoreStanza directedUnvailPresence = XMPPCoreStanza.getWrapper(StanzaBuilder.createPresenceStanza(
initiatingUser.getEntityFQ(), unrelatedUser.getEntityFQ(), null, PresenceStanzaType.UNAVAILABLE, null,
null).build());
handler.executeCore(directedUnvailPresence, sessionContext.getServerRuntimeContext(), true, sessionContext);
assertTrue(0 < receiverRelay.getCountDelivered());
// directed presence has been recorded internally
map = (Set<Entity>) sessionContext.getAttribute("DIRECTED_PRESENCE_MAP_" + initiatingUser.getBoundResourceId());
assertTrue(map.size() == 0);
ResourceState resourceState = sessionContext.getServerRuntimeContext().getResourceRegistry().getResourceState(
initiatingUser.getBoundResourceId());
assertTrue(ResourceState.isAvailable(resourceState));
Stanza directedUnavailPresence = unrelatedUser.getNextStanza();
assertNotNull(directedUnavailPresence);
assertTrue(PresenceStanza.isOfType(directedUnavailPresence)); // is presence
presenceStanza = new PresenceStanza(directedUnavailPresence);
assertEquals(initiatingUser.getEntityFQ(), presenceStanza.getFrom());
assertEquals(PresenceStanzaType.UNAVAILABLE, presenceStanza.getPresenceType());
}