Do not assume ES is running on localhost in tests

Remove references to http://localhost when closing
the ES indexes during tests.

Change-Id: I7c11cb8078bfcf5a8b7a337d764dcb90f7efbf42
diff --git a/javatests/com/google/gerrit/elasticsearch/ElasticV6QueryChangesTest.java b/javatests/com/google/gerrit/elasticsearch/ElasticV6QueryChangesTest.java
index cd46bf1..f1dcbaf 100644
--- a/javatests/com/google/gerrit/elasticsearch/ElasticV6QueryChangesTest.java
+++ b/javatests/com/google/gerrit/elasticsearch/ElasticV6QueryChangesTest.java
@@ -60,8 +60,10 @@
     client.execute(
         new HttpPost(
             String.format(
-                "http://localhost:%d/%s*/_close",
-                container.getHttpHost().getPort(), getSanitizedMethodName())),
+                "http://%s:%d/%s*/_close",
+                container.getHttpHost().getHostName(),
+                container.getHttpHost().getPort(),
+                getSanitizedMethodName())),
         HttpClientContext.create(),
         null);
   }
diff --git a/javatests/com/google/gerrit/elasticsearch/ElasticV7QueryChangesTest.java b/javatests/com/google/gerrit/elasticsearch/ElasticV7QueryChangesTest.java
index c8514e8..704f2f1 100644
--- a/javatests/com/google/gerrit/elasticsearch/ElasticV7QueryChangesTest.java
+++ b/javatests/com/google/gerrit/elasticsearch/ElasticV7QueryChangesTest.java
@@ -60,8 +60,10 @@
     client.execute(
         new HttpPost(
             String.format(
-                "http://localhost:%d/%s*/_close",
-                container.getHttpHost().getPort(), getSanitizedMethodName())),
+                "http://%s:%d/%s*/_close",
+                container.getHttpHost().getHostName(),
+                container.getHttpHost().getPort(),
+                getSanitizedMethodName())),
         HttpClientContext.create(),
         null);
   }