private static String processParameters(List<String> args, final List<? super String> listeners, String[] params) {
    String agentName = isJUnit5Preferred() ? JUNIT5_RUNNER_NAME : JUNIT4_RUNNER_NAME;
    List<String> result = new ArrayList<>(args.size());
    for (String arg : args) {
      if (arg.startsWith(IDE_VERSION)) {
        //ignore
      }
      else if (arg.equals(JUNIT3_PARAMETER)) {
        agentName = JUNIT3_RUNNER_NAME;
      }
      else if (arg.equals(JUNIT4_PARAMETER)) {
        agentName = JUNIT4_RUNNER_NAME;
      }
      else if (arg.equals(JUNIT5_PARAMETER)) {
        agentName = JUNIT5_RUNNER_NAME;
      }
      else {
        if (arg.startsWith("@name")) {
          params[0] = arg.substring("@name".length());
          continue;
        }
        else if (arg.startsWith("@w@")) {
          ourWorkingDirs = arg.substring(3);
          continue;
        }
        else if (arg.startsWith("@@@")) {
          final int pos = arg.indexOf(',');
          ourForkMode = arg.substring(3, pos);
          ourCommandFileName = arg.substring(pos + 1);
          continue;
        }
        else if (arg.startsWith("@@")) {
          if (new File(arg.substring(2)).exists()) {
            try {
              final BufferedReader reader = new BufferedReader(new FileReader(arg.substring(2)));
              String line;
              while ((line = reader.readLine()) != null) {
                listeners.add(line);
              }
            }
            catch (Exception e) {
              e.printStackTrace();
            }
          }
          continue;
        }
        else if (arg.startsWith(SOCKET)) {
          // the form of "-socket[<host>:]<port>" is expected here
          // for example "-sockethost.docker.internal:12345" or "-socket54321"
          final String value = arg.substring(SOCKET.length());
          final String host;
          final int port;
          // NB the host might be an IPv6 address (and this kind of address contains ":")
          int index = value.lastIndexOf(':');
          if (index == -1) {
            host = "127.0.0.1";
            port = Integer.parseInt(value);
          }
          else {
            host = value.substring(0, index);
            port = Integer.parseInt(value.substring(index + 1));
          }
          try {
            final Socket socket = new Socket(InetAddress.getByName(host), port);  //start collecting tests
            try (DataInputStream os = new DataInputStream(socket.getInputStream())) {
              os.readBoolean();//wait for ready flag
            }
          }
          catch (IOException e) {
            e.printStackTrace();
          }

          continue;
        }

        final int count = RepeatCount.getCount(arg);
        if (count != 0) {
          ourRepeatCount = arg;
          ourCount = count;
          continue;
        }

        result.add(arg);
      }
    }
    args.clear();
    args.addAll(result);
    if (JUNIT3_RUNNER_NAME.equals(agentName)) {
      try {
        Class.forName("org.junit.runner.Computer");
        agentName = JUNIT4_RUNNER_NAME;
      }
      catch (ClassNotFoundException e) {
        return JUNIT3_RUNNER_NAME;
      }
    }

    if (JUNIT4_RUNNER_NAME.equals(agentName)) {
      try {
        Class.forName("org.junit.Test");
      }
      catch (ClassNotFoundException e) {
        return JUNIT3_RUNNER_NAME;
      }
    }

    try {
      final String forceJUnit3 = System.getProperty("idea.force.junit3");
      if (Boolean.parseBoolean(forceJUnit3)) return JUNIT3_RUNNER_NAME;
    }
    catch (SecurityException ignored) {
    }
    return agentName;
  }
private static String processParameters(List<String> args, final List<? super String> listeners, String[] params)