public static void blockAccess(String domain) {
        // Remove any previous configuration for this remote server
        deleteConfiguration(domain);
        // Update the database with the new revoked permission
        RemoteServerConfiguration config = new RemoteServerConfiguration(domain);
        config.setPermission(Permission.blocked);
        addConfiguration(config);
        // Check if the remote server was connected and proceed to close the connection
        for (Session session : SessionManager.getInstance().getIncomingServerSessions(domain)) {
            Log.debug( "Closing session for domain '{}' as the domain is being blocked. Affected session: {}", domain, session );
            session.close();
        }
        // Can't just lookup a single remote server anymore, so check them all.
        for (DomainPair domainPair : SessionManager.getInstance().getOutgoingDomainPairs()) {
            if (domainPair.getRemote().equals(domain)) {
                Session session = SessionManager.getInstance().getOutgoingServerSession(domainPair);
                Log.debug( "Closing (domain-pair) session for domain '{}' as the domain is being blocked. Affected session: {}", domain, session );
                session.close();
            }
        }
    }
Blocks a remote server from connecting to the local server. If the remote server was
connected when the permission was revoked then the connection of the entity will be closed.

@param domain the domain of the remote server that is not allowed to connect.
xmppserver/src/main/java/org/jivesoftware/openfire/server/RemoteServerManager.java