### CI Link

https://gradle-enterprise.elastic.co/s/mw2zhgjnaroxk
https://gradle-enterprise.elastic.co/s/og2cnfo5yzhyi

In both cases the tests ran on the `graalvm-ce17` JVM.

### Repro line
NA

### Does it reproduce?

Didn't try

### Applicable branches

main

### Failure history

https://gradle-enterprise.elastic.co/scans/tests?search.timeZoneId=Europe/London&tests.container=org.elasticsearch.client.RestClientMultipleHostsTests&tests.test=classMethod

### Failure excerpt
```
com.carrotsearch.randomizedtesting.ThreadLeakError: There are still zombie threads that couldn't be terminated: 
  | 1) Thread[id=24, name=Libgraal MBean Registration, state=TIMED_WAITING, group=main] |  
  | at java.base@17.0.3/java.lang.Thread.sleep(Native Method) |  
  | at platform/jdk.internal.vm.compiler.management/org.graalvm.compiler.hotspot.management.Factory.run(Factory.java:111) |  
```
client/test/src/main/java/org/elasticsearch/client/RestClientTestCase.java
* Assert that the actual headers are the expected ones given the original default and request headers. Some headers can be ignored,
     * for instance in case the http client is adding its own automatically.
     *
     * @param defaultHeaders the default headers set to the REST client instance
     * @param requestHeaders the request headers sent with a particular request
     * @param actualHeaders the actual headers as a result of the provided default and request headers
     * @param ignoreHeaders header keys to be ignored as they are not part of default nor request headers, yet they
     *                      will be part of the actual ones
     */
    protected static void assertHeaders(
        final Header[] defaultHeaders,
        final Header[] requestHeaders,
        final Header[] actualHeaders,
        final Set<String> ignoreHeaders
    ) {
        final Map<String, List<String>> expectedHeaders = new HashMap<>();
        final Set<String> requestHeaderKeys = new HashSet<>();
        for (final Header header : requestHeaders) {
            final String name = header.getName();
            addValueToListEntry(expectedHeaders, name, header.getValue());
            requestHeaderKeys.add(name);
        }
        for (final Header defaultHeader : defaultHeaders) {
            final String name = defaultHeader.getName();
            if (requestHeaderKeys.contains(name) == false) {
                addValueToListEntry(expectedHeaders, name, defaultHeader.getValue());
            }
        }
        Set<String> actualIgnoredHeaders = new HashSet<>();
        for (Header responseHeader : actualHeaders) {