Connect to ElasticServer from Behind Proxy

Hi,

I have elastic instance sitting in the cloud. I need to connect to elastic instance from the application which is sitting behind the proxy.

I am using the Java Client to connect to elastic. Going through Transport client documentation, i could only infer that it needs the ip address of host and does not have any explicit api to specify proxy for connection.

Client client = TransportClient.builder().build()
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("host1"), 9300));

Could you please guide me on how to achieve this?

Do you need to funnel the traffic through a SOCKS proxy?