new-integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/TestUtils.java
private static boolean isLocalPortFree(int port) {
    LoggingFacade logger = getLogger();
    Socket socket = null;
    try {
      socket = new Socket(K8S_NODEPORT_HOST, port);
      return false;
    } catch (IOException ignored) {
      return true;
    } finally {
      if (socket != null) {
        try {
          socket.close();
        } catch (IOException ex) {
          logger.severe("can not close Socket {0}", ex.getMessage());
        }
      }
    }
  }
/**
   * Check if the given port number is free.
   *
   * @param port port number to check
   * @return true if the port is free, false otherwise
   */
Check if the given port number is free.
@param port port number to check
@return true if the port is free, false otherwise
Check if the given port number is free . @param port port number to check @return true if the port is free false otherwise
private static boolean isLocalPortFree(int port) {
    LoggingFacade logger = getLogger();
    Socket socket = null;
    try {
      socket = new Socket(K8S_NODEPORT_HOST, port);
      return false;
    } catch (IOException ignored) {
      return true;
    } finally {
      if (socket != null) {
        try {
          socket.close();
        } catch (IOException ex) {
          logger.severe("can not close Socket {0}", ex.getMessage());
        }
      }
    }
  }
private static boolean isLocalPortFree ( int port ) { LoggingFacade logger = getLogger ( ) ; Socket socket = null ; try { socket = new Socket ( K8S_NODEPORT_HOST , port ) ; return false ; } catch ( IOException ignored ) { return true ; } finally { if ( socket != null ) { try { socket . close ( ) ; } catch ( IOException ex ) { logger . severe ( "can not close Socket {0}" , ex . getMessage ( ) ) ; } } } }
Check if the given port number is free.
Check if the given port number is free .