Authentication using Java API and TransportClient

Here is how I create the transport client:

Settings settings = Settings.builder().build();
TransportAddress addr = new InetSocketTransportAddress(InetAddress.getLoopbackAddress(), 9300);
TransportClient client = new PreBuiltTransportClient(settings).addTransportAddress(addr);

I am using ES 5.0.

As far as using SSL, I am using whatever the default configurations are after installing xpack. The only modification I've made on either ES or xpack is adding the xpack.security.enabled property so I could try everything with authentication turned off. Again, the exact same client and configuration works when I disable security, but when I enable it, I get the previously specified error.

Thank you for the link. I'll go through that information that I previously had not found.