List of utility methods to do HTTP Port Find
int | getValidZooKeeperPort() Check from DEFAULT_ZK_PORT to (DEFAULT_ZK_PORT + TRY_PORT_COUNT) to see if there is valid port to launch embed zookeeper server. int zkValidPort = INITAL_ZK_PORT; int initialPort = DEFAULT_ZK_PORT; if (System.currentTimeMillis() % 2 == 0) { zkValidPort += RANDOM.nextInt(100); } else { zkValidPort -= RANDOM.nextInt(100); for (int i = initialPort; i < (initialPort + TRY_PORT_COUNT); i++) { ... |
URL | getWsdlLocation(String portPrefix) get Wsdl Location try { return new URL("http://localhost:9001/" + portPrefix + "PingService?wsdl"); } catch (MalformedURLException mue) { return null; |
String | getXmlReport(String fileName) Ucitava dati izvestaj preko servleta. String proxyHost = System.getProperty("proxyHost"); String proxyPort = System.getProperty("proxyHost"); System.setProperty("proxyHost", ""); System.setProperty("proxyPort", ""); System.setProperty("proxySet", "false"); StringBuffer buff = new StringBuffer(); try { URL url = new URL(reportServletUrl + "?reportFile=" + fileName); ... |
boolean | hasPermissionToBindPort(int port) has Permission To Bind Port ServerSocket s = null; try { s = new ServerSocket(port); return true; } catch (Exception e) { return false; } finally { if (s != null) ... |
boolean | isActivePort(int port) is Active Port Socket socket = null; boolean var3; try { InetAddress localAddress = InetAddress.getLocalHost(); socket = new Socket(localAddress, port); return true; } catch (ConnectException var20) { var3 = false; ... |
boolean | isAlive(String hostname, int port, int retries) is Alive int cnt = 0; System.out.println("Ping host:port " + hostname + ":" + port); while (cnt <= retries) { System.out.println("ping [#" + cnt + "] ..."); boolean reachable = isReachableByPing(hostname, port); if (reachable) return true; cnt++; ... |
boolean | isAvailablePort(int port) is Available Port ServerSocket ss = null; try { ss = new ServerSocket(port); ss.bind(null); return true; } catch (IOException e) { return false; } finally { ... |
boolean | isBindable(int port) is Bindable try { ServerSocket ss = new ServerSocket(port); ss.close(); ss = null; return true; } catch (BindException be) { return false; } catch (IOException e) { ... |
boolean | isBindedPort(String host, int port) is Binded Port boolean used = false; Socket socket = new Socket(); try { InetSocketAddress ip = new InetSocketAddress(host, port); socket.connect(ip, 5 * 1000); used = true; } catch (Exception ex) { ex.printStackTrace(); ... |
boolean | isBound(int port) Returns true if port is already bound by a process; otherwise returns false. InetSocketAddress address = new InetSocketAddress(port); return isBound(address); |