org.elasticsearch.common.transport.InetSocketTransportAddress not found on Elasticsearch 6

Elastic search 6.0 has removed InetSocketTransportAddress class. I have solved this By replacing InetSocketTransportAddress class with TransportAddress class.

// on startup

TransportClient client = new PreBuiltTransportClient(Settings.EMPTY)
        .addTransportAddress(new TransportAddress(InetAddress.getByName("host1"), 9300))
        .addTransportAddress(new TransportAddress(InetAddress.getByName("host2"), 9300));

// on shutdown

client.close();