public void processTestClass(TestClassRunInfo testClass) {
    if (remoteProcessor == null) {
      remoteProcessor = forkProcess();
    }

    remoteProcessor.processTestClass(testClass);
  }
  RemoteTestClassProcessor forkProcess() {
    WorkerProcessBuilder builder = workerFactory.create();
    builder.setBaseName("Gradle Test Executor");
    builder.applicationClasspath(classPath);
    builder.setLoadApplicationInSystemClassLoader(true);
    builder.worker(new TestWorker(processorFactory));
    options.copyTo(builder.getJavaCommand());
    buildConfigAction.execute(builder);

    workerProcess = builder.build();
    workerProcess.start();

    ObjectConnection connection = workerProcess.getConnection();
    connection.useParameterSerializer(TestEventSerializer.create());
    connection.addIncoming(TestResultProcessor.class, resultProcessor);
    RemoteTestClassProcessor remoteProcessor =
        connection.addOutgoing(RemoteTestClassProcessor.class);
    connection.connect();
    remoteProcessor.startProcessing();
    return remoteProcessor;
  }
 public void stop() {
   if (remoteProcessor != null) {
     remoteProcessor.stop();
     workerProcess.waitForStop();
   }
 }