@Test
  @RedisAvailable
  @SuppressWarnings("unchecked")
  public void testInt3442ProperlyStop() throws Exception {
    final String queueName = "si.test.testInt3442ProperlyStopTest";

    final RedisTemplate<String, Object> redisTemplate = new RedisTemplate<String, Object>();
    redisTemplate.setConnectionFactory(this.connectionFactory);
    redisTemplate.setEnableDefaultSerializer(false);
    redisTemplate.setKeySerializer(new StringRedisSerializer());
    redisTemplate.setValueSerializer(new JdkSerializationRedisSerializer());
    redisTemplate.afterPropertiesSet();

    RedisQueueMessageDrivenEndpoint endpoint =
        new RedisQueueMessageDrivenEndpoint(queueName, this.connectionFactory);
    BoundListOperations<String, byte[]> boundListOperations =
        TestUtils.getPropertyValue(endpoint, "boundListOperations", BoundListOperations.class);
    boundListOperations = Mockito.spy(boundListOperations);
    new DirectFieldAccessor(endpoint).setPropertyValue("boundListOperations", boundListOperations);
    endpoint.setBeanFactory(Mockito.mock(BeanFactory.class));
    endpoint.setOutputChannel(new DirectChannel());
    endpoint.setReceiveTimeout(1000);
    endpoint.setStopTimeout(100);

    ExecutorService executorService = Executors.newCachedThreadPool();
    endpoint.setTaskExecutor(executorService);

    endpoint.afterPropertiesSet();
    endpoint.start();

    redisTemplate.boundListOps(queueName).leftPush("foo");
    endpoint.stop();

    executorService.shutdown();
    assertTrue(executorService.awaitTermination(1, TimeUnit.SECONDS));

    Mockito.verify(boundListOperations).rightPush(Mockito.any(byte[].class));
  }