How to connect ES8.8 through TCP port & certificate in java?

Hi Experts,
i am able to connect the ES7.17 through tcp port , but in ES 8.8 library there is no class to connect tcp port.
Some code snippet is working in ES 7.17:

Client getClient() {
		Settings settings = Settings.builder()
				.put("client.transport.sniff", true)
				.put("xpack.security.transport.ssl.keystore.path", env.getProperty("es.path.cert"))// link to pkcs12 file
				.put("xpack.security.transport.ssl.truststore.path", env.getProperty("es.path.cert"))// link to pkcs12 file
				.put("xpack.security.transport.ssl.enabled", "true")
				.put("xpack.security.transport.ssl.verification_mode", "certificate")
				.put("cluster.name", env.getProperty("es.cluster.name"))
				.put("xpack.security.user", env.getProperty("metrics.elasticsearch.client.username", "admin") + ":" + env.getProperty("metrics.elasticsearch.client.password", "password"))
				.build();

		@SuppressWarnings("deprecation")
		TransportClient  client = new PreBuiltXPackTransportClient(settings);
		String hostsNames = env.getProperty("es.hosts.name"); //localhost:9300,localhost:10300
		String[] hosts = hostsNames.split(",");
		for (int i = 0; i < hosts.length; i++) {
			String host = hosts[i];
			log.info("ES host:port -> " + host); //localhost:9300
		    String[] esHost = host.split(":");
		    try {
				client.addTransportAddress(new TransportAddress(InetAddress.getByName(esHost[0]), Integer.valueOf(esHost[1])));

		    } catch (Exception e) {
				log.debug("unable to connect to elasticSearch" + e.getMessage());
			}
		}
		return client;
	}

The transport client has been deprecated and is no longer supported in Elasticsearch 8.x. You should instead switch to the new Java client.