List of usage examples for org.springframework.data.redis.connection DefaultStringRedisConnection get
@Override
public String get(String key)
From source file:org.springframework.data.redis.connection.lettuce.LettuceConnectionFactoryTests.java
@SuppressWarnings("rawtypes") @Test/* ww w .ja v a2s. c om*/ public void testGetNewConnectionOnError() throws Exception { factory.setValidateConnection(true); connection.lPush("alist", "baz"); RedisAsyncCommands nativeConn = (RedisAsyncCommands) connection.getNativeConnection(); nativeConn.getStatefulConnection().close(); // Give some time for async channel close Thread.sleep(500); connection.bLPop(1, "alist".getBytes()); try { connection.get("test3"); fail("Expected exception using natively closed conn"); } catch (RedisSystemException e) { // expected, shared conn is closed } DefaultStringRedisConnection conn2 = new DefaultStringRedisConnection(factory.getConnection()); assertNotSame(nativeConn, conn2.getNativeConnection()); conn2.set("anotherkey", "anothervalue"); assertEquals("anothervalue", conn2.get("anotherkey")); conn2.close(); }