title: Connection Timeout with testcontainers and redis
body: <p>I do integration tests using Spring Boot, TestContainers, redis and Junit 5.
  I am facing a weird behavior, when I all the integration tests, I keep having this log displaying :</p>
  <p>Cannot reconnect to [localhost:55133]: Connection refused: localhost/127.0.0.1:55133</p>
  <p>and this exception :</p>
  <pre><code>org.springframework.dao.QueryTimeoutException: Redis command timed out; nested exception is io.lettuce.core.RedisCommandTimeoutException: Command timed out after 1 minute(s)
  
  at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java:70)
  </code></pre>
  <p>But I run the tests individually, I dont have this behavior.</p>
  <p>I use Junit5 and I am using Junit5 extension to start and stop my redis container :</p>
  <pre><code>public class RedisTestContainerExtension implements BeforeAllCallback, AfterAllCallback {
  
      private GenericContainer&lt;?&gt; redis;
  
      @Override
      public void beforeAll(ExtensionContext extensionContext) throws Exception {
          redis = new GenericContainer&lt;&gt;(DockerImageName.parse(&quot;redis:5.0.3-alpine&quot;))
                  .withCommand(&quot;redis-server&quot;,&quot;--requirepass&quot;, &quot;password&quot;)
                  .waitingFor(Wait.forListeningPort())
                  .withStartupTimeout(Duration.ofMinutes(2))
                  .withExposedPorts(6379);
          redis.start();
          System.setProperty(&quot;APP_REDIS_CONVERSATIONS_HOST&quot;,redis.getHost());
          System.setProperty(&quot;APP_REDIS_CONVERSATIONS_PORT&quot;,redis.getFirstMappedPort().toString());
          System.setProperty(&quot;APP_REDIS_CONVERSATIONS_PASSWORD&quot;,&quot;password&quot;);
          System.setProperty(&quot;APP_REDIS_CONVERSATIONS_TTL&quot;,&quot;600m&quot;);
      }
  
      @Override
      public void afterAll(ExtensionContext extensionContext) throws Exception {
          if(redis != null){
              redis.stop();
          }
      }
  }
  </code></pre>
  <p>And I add this file as an extension to my integration test :</p>
  <pre><code>@ExtendWith({SpringExtension.class, RedisTestContainerExtension.class})
  @SpringBootTest(classes = ConversationsApplication.class)
  class MyIntegrationTest {
   ...
   }
  </code></pre>
  <p>Can anyone help me fix this situation.</p>