Four tests failed together with the message `java.net.BindException: Address already in use`, and the tests have been failing a few times in the last couple of days on branch `8.5` and `8.6`. The failing tests:

* testFailOverOnFollower
* testReadRequestsReturnLatestMappingVersion
* testFollowIndexAndCloseNode
* testReadRequestsReturnLatestMappingVersion

Some test histories:

*. https://gradle-enterprise.elastic.co/scans/tests?search.timeZoneId=Europe/Stockholm&tests.container=org.elasticsearch.xpack.ccr.FollowerFailOverIT&tests.test=testAddNewReplicasOnFollower
* https://gradle-enterprise.elastic.co/scans/tests?search.timeZoneId=Europe/Stockholm&tests.container=org.elasticsearch.xpack.ccr.FollowerFailOverIT&tests.test=testReadRequestsReturnLatestMappingVersion

**Build scan:**
https://gradle-enterprise.elastic.co/s/es4ybjld57meo/tests/:x-pack:plugin:ccr:internalClusterTest/org.elasticsearch.xpack.ccr.FollowerFailOverIT/testFailOverOnFollower

**Reproduction line:**
```
./gradlew ':x-pack:plugin:ccr:internalClusterTest' --tests "org.elasticsearch.xpack.ccr.FollowerFailOverIT.testFailOverOnFollower" -Dtests.seed=AEF5EB246025C830 -Dtests.locale=es-SV -Dtests.timezone=Europe/Sofia -Druntime.java=17
```

**Applicable branches:**
8.5, 8.6

**Reproduces locally?:**
No

**Failure history:**
https://gradle-enterprise.elastic.co/scans/tests?tests.container=org.elasticsearch.xpack.ccr.FollowerFailOverIT&tests.test=testFailOverOnFollower

**Failure excerpt:**
```
org.elasticsearch.transport.BindTransportException: Failed to bind to [::1]:[32771-32800]

  at org.elasticsearch.transport.TcpTransport.bindToPort(TcpTransport.java:505)
  at org.elasticsearch.transport.TcpTransport.bindServer(TcpTransport.java:466)
  at org.elasticsearch.transport.netty4.Netty4Transport.doStart(Netty4Transport.java:142)
  at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:43)
  at org.elasticsearch.test.transport.StubbableTransport.start(StubbableTransport.java:203)
  at org.elasticsearch.transport.TransportService.doStart(TransportService.java:311)
  at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:43)
  at org.elasticsearch.node.Node.start(Node.java:1296)
  at org.elasticsearch.test.InternalTestCluster$NodeAndClient.startNode(InternalTestCluster.java:982)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
  at java.util.concurrent.FutureTask.run(FutureTask.java:264)
  at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:825)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
  at java.lang.Thread.run(Thread.java:833)

  Caused by: java.net.BindException: Address already in use

    at sun.nio.ch.Net.bind0(Net.java:-2)
    at sun.nio.ch.Net.bind(Net.java:555)
    at sun.nio.ch.ServerSocketChannelImpl.netBind(ServerSocketChannelImpl.java:337)
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:294)
    at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:141)
    at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:562)
    at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1334)
    at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:506)
    at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:491)
    at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:973)
    at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:260)
    at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:356)
    at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)
    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167)
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:503)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:995)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at java.lang.Thread.run(Thread.java:833)

```
test/framework/src/main/java/org/elasticsearch/test/ESTestCase.java
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.Appender;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.appender.AbstractAppender;
import org.apache.logging.log4j.core.config.Configurator;
import org.apache.logging.log4j.core.layout.PatternLayout;
import org.apache.logging.log4j.status.StatusConsoleListener;
import org.apache.logging.log4j.status.StatusData;
import org.apache.logging.log4j.status.StatusLogger;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.tests.util.LuceneTestCase;
import org.apache.lucene.tests.util.LuceneTestCase.SuppressCodecs;
import org.apache.lucene.tests.util.TestRuleMarkFailure;
import org.apache.lucene.tests.util.TestUtil;
import org.apache.lucene.tests.util.TimeUnits;
import org.apache.lucene.util.SetOnce;
import org.elasticsearch.Version;
import org.elasticsearch.bootstrap.BootstrapForTesting;
import org.elasticsearch.client.internal.Requests;
import org.elasticsearch.cluster.ClusterModule;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.io.stream.BytesStreamOutput;
import org.elasticsearch.common.io.stream.NamedWriteable;
import org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Writeable;