[DOCS] Replaces InetSocketTransportAddress in code samples (elastic/x-pack-elasticsearch#4404)

Original commit: elastic/x-pack-elasticsearch@85b11cccc7
This commit is contained in:
Lisa Cawley 2018-04-18 09:15:43 -07:00 committed by GitHub
parent fd3f079276
commit dcedffb0f0
1 changed files with 9 additions and 9 deletions

View File

@ -43,8 +43,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
@ -64,7 +64,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;
@ -76,8 +76,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()));
@ -130,8 +130,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))
--------------------------------------------------------------------------------------------------
--
@ -158,8 +158,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,