test: Simplify SSL setup

We can always use the container's getHost() instead of trying to parse
the value from the DOCKER_HOST environment variable.

Change-Id: I7807a6d0d1b6b9156b375d956331988d43e0362f
diff --git a/src/test/java/com/google/gerrit/elasticsearch/ElasticContainer.java b/src/test/java/com/google/gerrit/elasticsearch/ElasticContainer.java
index af64c7e..a65e57c 100644
--- a/src/test/java/com/google/gerrit/elasticsearch/ElasticContainer.java
+++ b/src/test/java/com/google/gerrit/elasticsearch/ElasticContainer.java
@@ -15,8 +15,6 @@
 package com.google.gerrit.elasticsearch;
 
 import com.google.common.flogger.FluentLogger;
-import java.net.URI;
-import java.net.URISyntaxException;
 import java.nio.file.Path;
 import org.apache.http.HttpHost;
 import org.slf4j.Logger;
@@ -34,21 +32,6 @@
   public static ElasticContainer createAndStart(ElasticVersion version) {
     ElasticContainer container = new ElasticContainer(version);
     try {
-      String hostname = System.getenv("DOCKER_HOST");
-      if (hostname != null) {
-        try {
-          hostname = new URI(hostname).getHost();
-          logger.atInfo().log("Using hostname from DOCKER_HOST: %s", hostname);
-        } catch (URISyntaxException e) {
-          logger.atWarning().log(
-              "Failed to parse DOCKER_HOST environment variable value (%s). Continuing as if unset.",
-              hostname);
-        }
-      }
-      if (hostname == null) {
-        hostname = container.getHost();
-        logger.atInfo().log("Using hostname from container.getHost(): %s", hostname);
-      }
       Path certs = Path.of("/usr/share/elasticsearch/config/certs");
       String customizedCertPath = certs.resolve("http_ca_customized.crt").toString();
       String sslKeyPath = certs.resolve("elasticsearch.key").toString();
@@ -77,7 +60,7 @@
                               + " -out "
                               + sslCrtPath
                               + " -days 365 -nodes -subj \"/CN="
-                              + hostname
+                              + container.getHost()
                               + "\";"
                               + "openssl x509 -outform der -in "
                               + sslCrtPath