### 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
final String name = responseHeader.getName();
            if (ignoreHeaders.contains(name)) {
                expectedHeaders.remove(name);
                actualIgnoredHeaders.add(name);
                continue;
            }
            final String value = responseHeader.getValue();
            final List<String> values = expectedHeaders.get(name);
            assertNotNull("found response header [" + name + "] that wasn't originally sent: " + value, values);
            assertTrue("found incorrect response header [" + name + "]: " + value, values.remove(value));
            if (values.isEmpty()) {
                expectedHeaders.remove(name);
            }
        }
        assertEquals("some headers meant to be ignored were not part of the actual headers", ignoreHeaders, actualIgnoredHeaders);
        assertTrue("some headers that were sent weren't returned " + expectedHeaders, expectedHeaders.isEmpty());
    }
    private static void addValueToListEntry(final Map<String, List<String>> map, final String name, final String value) {
        List<String> values = map.get(name);
        if (values == null) {
            values = new ArrayList<>();
            map.put(name, values);
        }
        values.add(value);
    }
    public static boolean inFipsJvm() {
        return Boolean.parseBoolean(System.getProperty("tests.fips.enabled"));
    }
}