@Bean
	public RedisConnectionFactory connectionFactory() {
		try {
			JedisConnectionFactory cf = new JedisConnectionFactory();
			cf.setHostName("localhost");
			cf.setPort(6379);
			cf.afterPropertiesSet();
			cf.getConnection().close();
			return cf;
		} // The following is to have setup properly finishing
		// The actual test(s) won't be executed thx to RedisAvailableRule
		catch (RedisConnectionFailureException e) {
			RedisConnectionFactory mockCF = mock(RedisConnectionFactory.class);
			when(mockCF.getConnection()).thenReturn(mock(RedisConnection.class));
			return mockCF;
		}
	}
@author David Turanski
@author Gary Russell
spring-xd-analytics/src/test/java/org/springframework/xd/analytics/metrics/integration/RichGaugeHandlerTests.java