code: public void stop() {
      lock.lock();
  
      WebDriverException toThrow = null;
      try {
        if (process == null) {
          return;
        }
  
        if (hasShutdownEndpoint()) {
          try {
            URL killUrl = new URL(url.toString() + "/shutdown");
            new UrlChecker().waitUntilUnavailable(3, SECONDS, killUrl);
          } catch (MalformedURLException e) {
            toThrow = new WebDriverException(e);
          } catch (UrlChecker.TimeoutException e) {
            toThrow = new WebDriverException("Timed out waiting for driver server to shutdown.", e);
          }
        }
  
        process.destroy();
  
        if (getOutputStream() instanceof FileOutputStream) {
          try {
            getOutputStream().close();
          } catch (IOException e) {
          }
        }
      } finally {
        process = null;
        lock.unlock();
      }
  
      if (toThrow != null) {
        throw toThrow;
      }
    }
docs: Stops this service if it is currently running. This method will attempt to block until the
  server has been fully shutdown.
  
  @see #start()