use host address instead of host name in tests to not do host lookup

This commit is contained in:
Shay Banon 2013-07-24 17:22:18 +02:00
parent ed473e272d
commit a3c3d4073b
1 changed files with 4 additions and 5 deletions

View File

@ -18,13 +18,12 @@
*/
package org.elasticsearch.test.integration.rest.helper;
import com.google.common.base.Charsets;
import org.elasticsearch.ElasticSearchException;
import org.elasticsearch.common.io.Streams;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.elasticsearch.common.transport.TransportAddress;
import com.google.common.base.Charsets;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@ -32,8 +31,8 @@ import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Map;
import java.util.List;
import java.util.Map;
public class HttpClient {
@ -42,7 +41,7 @@ public class HttpClient {
public HttpClient(TransportAddress transportAddress) {
InetSocketAddress address = ((InetSocketTransportAddress) transportAddress).address();
try {
baseUrl = new URL("http", address.getHostName(), address.getPort(), "/");
baseUrl = new URL("http", address.getAddress().getHostAddress(), address.getPort(), "/");
} catch (MalformedURLException e) {
throw new ElasticSearchException("", e);
}