public static int getPortForServer(String domain) {
        int port = JiveGlobals.getIntProperty(ConnectionSettings.Server.REMOTE_SERVER_PORT, ConnectionManager.DEFAULT_SERVER_PORT);
        RemoteServerConfiguration config = getConfiguration(domain);
        if (config != null) {
            port = config.getRemotePort();
            if (port == 0) {
                port = JiveGlobals
                        .getIntProperty(ConnectionSettings.Server.REMOTE_SERVER_PORT, ConnectionManager.DEFAULT_SERVER_PORT);
            }
        }
        return port;
    }
Returns the remote port to connect for the specified remote server. If no port was
defined then use the default port (e.g. 5269).

@param domain the domain of the remote server to get the remote port to connect to.
@return the remote port to connect for the specified remote server.
xmppserver/src/main/java/org/jivesoftware/openfire/server/RemoteServerManager.java