public static synchronized void startServer(String dirPath, int port, int authMode,
			boolean enableAltLoginName, boolean enableSSHAuthentication,
			boolean enableAnonymousAuthentication) throws IOException {

		if (port == 0) {
			port = GHIDRA_TEST_SERVER_PORT;
		}

		Msg.debug(ServerTestUtil.class, "--- Preparing to start Ghidra Server ---");
		Msg.debug(ServerTestUtil.class,
			"     Authentication: " + (authMode < 0 ? "None" : AUTH_MODES[authMode]));
		Msg.debug(ServerTestUtil.class, "     Enable Alternate Login Name: " + enableAltLoginName);
		Msg.debug(ServerTestUtil.class,
			"     Enable Anonymous Login: " + enableAnonymousAuthentication);

		// Force client-side use of newly generated CA certificates
		System.setProperty(ApplicationTrustManagerFactory.GHIDRA_CACERTS_PATH_PROPERTY,
			getTestPkiCACertsPath());
		SSLContextInitializer.initialize(true);

		ArrayList<String> argList = new ArrayList<>();
		String javaCommand =
			System.getProperty("java.home") + File.separator + "bin" + File.separator + "java";
		argList.add(javaCommand);

		argList.add("-cp");
		argList.add(System.getProperty("java.class.path"));

		argList.add("-Xmx512M");

		argList.add("-Xdebug");
		argList.add("-Xnoagent");
		argList.add("-Djava.compiler=NONE");
		argList.add("-D" + ApplicationTrustManagerFactory.GHIDRA_CACERTS_PATH_PROPERTY + "=" +
			getTestPkiCACertsPath());
		argList.add("-D" + ApplicationKeyManagerFactory.KEYSTORE_PATH_PROPERTY + "=" +
			getTestPkiServerKeystorePath());
		argList.add("-D" + ApplicationKeyManagerFactory.KEYSTORE_PASSWORD_PROPERTY + "=" +
			TEST_PKI_SERVER_PASSPHRASE);
		argList.add("-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=*:18202"); // *: for remote debug support
		argList.add("-DSystemUtilities.isTesting=true");

		// -Djava.security.policy=C:/policy
//		URL policy = ResourceManager.getResource("policy");
//		if (policy == null) {
//			throw new RuntimeException("Failed to find security policy resource");
//		}
//		argList.add("-Djava.security.policy=" + policy.toExternalForm());

		argList.add("ghidra.server.remote.GhidraServer");
		if (authMode >= 0) {
			argList.add("-a" + authMode);
		}
		if (enableAltLoginName) {
			argList.add("-u");
		}
		if (enableSSHAuthentication) {
			argList.add("-ssh");
		}
		if (enableAnonymousAuthentication) {
			argList.add("-anonymous");
		}

		argList.add("-ip" + LOCALHOST); // bind to loopback interface
		argList.add("-p" + port);
		argList.add(dirPath);

		String[] args = new String[argList.size()];
		argList.toArray(args);

		System.out.println();
		for (String arg : argList) {
			boolean includeQuotes = arg.indexOf(' ') != -1;
			if (includeQuotes) {
				System.out.print("'");
			}
			System.out.print(arg);
			if (includeQuotes) {
				System.out.print("'");
			}
			System.out.print(" ");
		}
		System.out.println();

		try {
			serverProcess = Runtime.getRuntime().exec(args);
			serverRepositories = dirPath;

			cmdOut = new IOThread(serverProcess.getInputStream());
			cmdErr = new IOThread(serverProcess.getErrorStream());
			cmdOut.start();
			cmdErr.start();
		}
		catch (Exception e) {
			e.printStackTrace();
			throw new AssertException("Exception starting Ghidra Server", e);
		}

		Msg.info(ServerTestUtil.class, "Waiting for Ghidra Server RMI registration to complete...");
		cmdOut.waitForServerStartOrTermination(); // based upon message output only
		if (!cmdOut.serverStartComplete) {
			throw new AssertException("Ghidra Server failed to start");
		}

		waitUntilServerAvailable(GHIDRA_TEST_SERVER_PORT);
	}
Start a server instance on the specified port.
This server must be disposed before attempting to create another.
@param dirPath server root directory
@param port RMI registry port, 0 indicates that default port should be used
@param authMode authentication mode (-1 for no authentication)
@param enableAltLoginName if true enable alternate login name
@param enableSSHAuthentication if true SSH authentication will be enabled
@param enableAnonymousAuthentication if true anonymous usage is allowed
@throws IOException
Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/server/remote/ServerTestUtil.java