code: public static boolean isBusyPort(int port) {
      boolean ret = true;
      ServerSocket serverSocket = null;
      try {
        serverSocket = new ServerSocket(port);
        ret = false;
      } catch (Exception e) {
      } finally {
        if (serverSocket != null) {
          try {
            serverSocket.close();
          } catch (IOException e) {
            e.printStackTrace();
          }
        }
      }
      return ret;
    }
docs: 检查端口号是否被占用