TracingRedisConnectionFactory implements RedisConnectionFactory,
    ReactiveRedisConnectionFactory { @Override public RedisConnection getConnection() { RedisConnection connection = this.delegate.getConnection(); if (connection instanceof RedisClusterConnection) { return new TracingRedisClusterConnection((RedisClusterConnection) connection, tracingConfiguration); } return new TracingRedisConnection(connection, tracingConfiguration); } TracingRedisConnectionFactory(RedisConnectionFactory delegate,
      TracingConfiguration tracingConfiguration); @Override RedisConnection getConnection(); @Override RedisClusterConnection getClusterConnection(); @Override boolean getConvertPipelineAndTxResults(); @Override RedisSentinelConnection getSentinelConnection(); @Override DataAccessException translateExceptionIfPossible(RuntimeException e); @Override ReactiveRedisConnection getReactiveConnection(); @Override ReactiveRedisClusterConnection getReactiveClusterConnection();  }
@Test public void connectionIsTracingRedisConnection() { RedisConnection connection = connectionFactory.getConnection(); verify(delegate).getConnection(); assertTrue(connection instanceof TracingRedisConnection); }
@Test public void delegatesClusterConnectionIfCluster() { RedisConnectionFactory connectionFactory = mock(RedisConnectionFactory.class); when(connectionFactory.getConnection()).thenReturn(mock(RedisClusterConnection.class)); TracingRedisConnectionFactory tracingConnectionFactory = new TracingRedisConnectionFactory( connectionFactory, new TracingConfiguration.Builder(tracer).traceWithActiveSpanOnly(false).build()); assertTrue(tracingConnectionFactory.getConnection() instanceof RedisClusterConnection); }