public boolean isAnonymousClientSession(@Nonnull final JID address) {
        // JID's node and resource are the same for anonymous sessions. When provided with a bare JID, 'auto-complete' it.
        final JID correctedJid = address.getResource() != null ? address : new JID(address.getNode(), address.getDomain(), address.getNode(), true);
        final ClientSession session = getSession(correctedJid);
        return session != null && session.isAnonymousUser();
    }
Change the priority of a session, that was already available, associated with the sender.

@param session   The session whose presence priority has been modified
@param oldPriority The old priority for the session
xmppserver/src/main/java/org/jivesoftware/openfire/SessionManager.java