[DOCS] Replaces InetSocketTransportAddress in code samples (elastic/x-pack-elasticsearch#4404)
Original commit: elastic/x-pack-elasticsearch@2b23dcb3b9fa6a77781cc590fb10640f2f756788
@@ -64,8 +64,8 @@ TransportClient client = new PreBuiltXPackTransportClient(Settings.builder()
.put("xpack.security.user", "transport_client_user:x-pack-test-password")
...
.build())
- .addTransportAddress(new InetSocketTransportAddress("localhost", 9300))
- .addTransportAddress(new InetSocketTransportAddress("localhost", 9301));
+ .addTransportAddress(new TransportAddress("localhost", 9300))
+ .addTransportAddress(new TransportAddress("localhost", 9301));
-------------------------------------------------------------------------------------------------
WARNING: If you configure a transport client without SSL, passwords are sent in
@@ -85,7 +85,7 @@ request:
--------------------------------------------------------------------------------------------------
import org.elasticsearch.common.settings.SecureString;
import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.transport.InetSocketTransportAddress;
+import org.elasticsearch.common.transport.TransportAddress;
import org.elasticsearch.xpack.client.PreBuiltXPackTransportClient;
import static UsernamePasswordToken.basicAuthHeaderValue;
@@ -97,8 +97,8 @@ TransportClient client = new PreBuiltXPackTransportClient(Settings.builder()
...
.build())
.build()
- .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9300))
- .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9301))
+ .addTransportAddress(new TransportAddress(InetAddress.getByName("localhost"), 9300))
+ .addTransportAddress(new TransportAddress(InetAddress.getByName("localhost"), 9301))
String token = basicAuthHeaderValue("test_user", new SecureString("x-pack-test-password".toCharArray()));
@@ -151,8 +151,8 @@ TransportClient client = new PreBuiltXPackTransportClient(Settings.builder()
.put("xpack.security.transport.ssl.enabled", "true")
...
.build())
- .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9300))
- .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9301))
+ .addTransportAddress(new TransportAddress(InetAddress.getByName("localhost"), 9300))
+ .addTransportAddress(new TransportAddress(InetAddress.getByName("localhost"), 9301))
--------------------------------------------------------------------------------------------------
--
@@ -179,8 +179,8 @@ TransportClient client = new PreBuiltXPackTransportClient(Settings.builder()
.put("xpack.security.transport.ssl.enabled", "true")
...
.build())
- .addTransportAddress(new InetSocketTransportAddress("localhost", 9300))
- .addTransportAddress(new InetSocketTransportAddress("localhost", 9301));
+ .addTransportAddress(new TransportAddress("localhost", 9300))
+ .addTransportAddress(new TransportAddress("localhost", 9301));
------------------------------------------------------------------------------------------------------
NOTE: If you are using a public CA that is already trusted by the Java runtime,
