We are caching the created connection, and use ping often to ensure that the connection is still valid and would like it to fail quickly if not so we can create a new one.
With the Java High Level REST Client we can provide RequestOptions allowing us to set a short timeout for the ping.
boolean response = client.ping(myPingRequestOptions);
This was very helpful as you could have different timeouts for searches and pings.
With the new Java API Client it looks like you cannot pass such custom request options and only set timeouts when creating the connection:
Is there anyway to reuse the same connection but set a different timeout for the ping?