Checks if rmiregistry is running on the specified port.

@param port
@return true if rmiregistry is running on the specified port, false
otherwise
352982
public static boolean isRMIRegistryRunning(Configuration configuration, int port) {
        try {
            final Registry registry = RegistryFinder.getInstance().getRegistry(configuration, port);
            registry.list();
            return true;
        } catch (RemoteException ex) {
            return false;
        } catch (Exception e) {
            return false;
        }
    }
457085
public static boolean isPortAvailable(String host, int port) {
        try {
            Socket socket = new Socket(host, port);
            socket.close();
            return false;
        } catch (IOException e) {
            return true;
        }
    }
280806
def detect_port(port):
    ''''''
    socket_test = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
    try:
        socket_test.connect(('127.0.0.1', int(port)))
        socket_test.close()
        return True
    except:
        return False
1112372
private boolean validateServer(String host, int port){
        if(host==null || host.isEmpty()){
            return false;
        }
        if(port <=0 || port > 65535){
            return false;
        }
        return true;
    }
596195
private static boolean isAvailable(int thePort) {
		ourLog.info("Testing a bind on thePort {}", thePort);
		try (ServerSocket ss = new ServerSocket()) {
			ss.setReuseAddress(true);
			ss.bind(new InetSocketAddress("0.0.0.0", thePort));
			try (DatagramSocket ds = new DatagramSocket()) {
				ds.setReuseAddress(true);
				ds.connect(new InetSocketAddress("127.0.0.1", thePort));
				ourLog.info("Successfully bound thePort {}", thePort);
			} catch (IOException e) {
				ourLog.info("Failed to bind thePort {}: {}", thePort, e.toString());
				return false;
			}
		} catch (IOException e) {
			ourLog.info("Failed to bind thePort {}: {}", thePort, e.toString());
			return false;
		}

		try (ServerSocket ss = new ServerSocket()) {
			ss.setReuseAddress(true);
			ss.bind(new InetSocketAddress("localhost", thePort));
		} catch (IOException e) {
			ourLog.info("Failed to bind thePort {}: {}", thePort, e.toString());
			return false;
		}

		return true;
	}
1212233
def _check_vbox_port_forwarding(self):
        

        result = yield from self._execute("showvminfo", [self._vmname, "--machinereadable"])
        for info in result.splitlines():
            if '=' in info:
                name, value = info.split('=', 1)
                if name.startswith("Forwarding") and value.strip('"').startswith("GNS3VM"):
                    return True
        return False
789332
function shouldProxy(hostname, port) {
  var NO_PROXY = getEnv('no_proxy').toLowerCase();
  if (!NO_PROXY) {
    return true;  // Always proxy if NO_PROXY is not set.
  }
  if (NO_PROXY === '*') {
    return false;  // Never proxy if wildcard is set.
  }

  return NO_PROXY.split(/[,\s]/).every(function(proxy) {
    if (!proxy) {
      return true;  // Skip zero-length hosts.
    }
    var parsedProxy = proxy.match(/^(.+):(\d+)$/);
    var parsedProxyHostname = parsedProxy ? parsedProxy[1] : proxy;
    var parsedProxyPort = parsedProxy ? parseInt(parsedProxy[2]) : 0;
    if (parsedProxyPort && parsedProxyPort !== port) {
      return true;  // Skip if ports don't match.
    }

    if (!/^[.*]/.test(parsedProxyHostname)) {
      // No wildcards, so stop proxying if there is an exact match.
      return hostname !== parsedProxyHostname;
    }

    if (parsedProxyHostname.charAt(0) === '*') {
      // Remove leading wildcard.
      parsedProxyHostname = parsedProxyHostname.slice(1);
    }
    // Stop proxying if the hostname ends with the no_proxy host.
    return !stringEndsWith.call(hostname, parsedProxyHostname);
  });
}
736695
public void setPort(int port)
    {
        if (_address == null || _address.getHostName() == null)
            _address= new InetSocketAddress(port);
        else
            _address= new InetSocketAddress(_address.getHostName(), port);
    }
531209
def has_port(self, port):
        '''

        '''
        with self._mutex:
            for p in self.ports:
                if not p[1]:
                    # Port owner not in tree, so unknown
                    continue
                if port.object._is_equivalent(p[1].object):
                    return True
            return False
834137
public synchronized void destroyForPort(int port)
   {
      synchronized(portMap)
      {
         UndertowServerEngine ref = portMap.remove(port);
         if (ref != null)
         {
            if (LOG.isDebugEnabled())
            {
               LOG.debug("Stopping HttpServer Engine on port " + port + ".");
            }
            try
            {
               ref.stop();
            }
            catch (Exception e)
            {
               LOG.warn("", e);
            }
         }
      }
   }
104091
static boolean isServerOrHostController(ImmutableManagementResourceRegistration resourceRegistration) {
        return resourceRegistration.getProcessType().isServer() || !ModelDescriptionConstants.PROFILE.equals(resourceRegistration.getPathAddress().getElement(0).getKey());
    }
994126
def has_port_by_ref(self, port_ref):
        '''

        '''
        with self._mutex:
            if self.get_port_by_ref(self, port_ref):
                return True
            return False
438890
public static boolean bindPort(Session session, String remoteHost, int remotePort, int localPort) throws JschRuntimeException {
		if (session != null && session.isConnected()) {
			try {
				session.setPortForwardingL(localPort, remoteHost, remotePort);
			} catch (JSchException e) {
				throw new JschRuntimeException(e, "From [{}] mapping to [{}] error！", remoteHost, localPort);
			}
			return true;
		}
		return false;
	}
369677
def port_is_used(port, host='127.0.0.1'):
    
    unused = _can_bind(port, host) and _refuses_connection(port, host)
    return not unused
1135193
@Override
  public boolean isExported(String name, boolean local) {
    return super.isExported(name, local) || (!local && name.startsWith("_"));
  }
741664
public static boolean isUsingNonDefaultPort(URI uri) {
        String scheme = StringUtils.lowerCase(uri.getScheme());
        int port = uri.getPort();

        if (port <= 0) return false;
        if (scheme.equals("http") && port == 80) return false;
        if (scheme.equals("https") && port == 443) return false;

        return true;
    }
183441
private static boolean isSameNodeAndServer(ObjectName mName) {
        String processName = mName.getKeyProperty("process");
        String nodeName = mName.getKeyProperty("node");

        if (tc.isDebugEnabled())
            Tr.debug(tc, "isSameNodeAndServer: " + mName.toString());

        if (processName != null && !processName.equals(PmiRegistry.serverName)) {
            // print only when debug is enabled since customers get worried seeing this message
            if (tc.isDebugEnabled())
                Tr.warning(tc, "PMI0002W", mName.toString() + ", expected process name is " + PmiRegistry.serverName);
            return false;
        }
        if (nodeName != null && !nodeName.equals(PmiRegistry.nodeName)) {
            // print only when debug is enabled since customers get worried seeing this message
            if (tc.isDebugEnabled())
                Tr.warning(tc, "PMI0002W", mName.toString() + ", expected node name is " + PmiRegistry.nodeName);
            return false;
        }

        return true;
    }