public List<IncomingServerSession> getIncomingServerSessions(String domain) {
        List<StreamID> streamIDs;
        // Get list of sockets/sessions coming from the remote domain
        Lock lock = domainSessionsCache.getLock(domain);
        lock.lock();
        try {
            streamIDs = domainSessionsCache.get(domain);
        }
        finally {
            lock.unlock();
        }

        if (streamIDs == null) {
            return Collections.emptyList();
        }
        else {
            // Collect the sessions associated to the found stream IDs
            List<IncomingServerSession> sessions = new ArrayList<>();
            for (StreamID streamID : streamIDs) {
                // Search in local hosted sessions
                IncomingServerSession session = localSessionManager.getIncomingServerSession(streamID);
                RemoteSessionLocator locator = server.getRemoteSessionLocator();
                if (session == null && locator != null) {
                    // Get the node hosting this session
                    final IncomingServerSessionInfo incomingServerSessionInfo = incomingServerSessionInfoCache.get(streamID);
                    if (incomingServerSessionInfo != null) {
                        session = locator.getIncomingServerSession(incomingServerSessionInfo.getNodeID().toByteArray(), streamID);
                    }
                }
                if (session != null) {
                    sessions.add(session);
                }
            }
            return sessions;
        }
    }
Returns the list of sessions that were originated by a remote server. The list will be
ordered chronologically.

IncomingServerSession can only receive packets from the remote
server but are not capable of sending packets to the remote server.

@param domain the name of the remote server.
@return the sessions that were originated by a remote server.
xmppserver/src/main/java/org/jivesoftware/openfire/SessionManager.java