Example usage for org.springframework.data.redis.connection StringRedisConnection ping

List of usage examples for org.springframework.data.redis.connection StringRedisConnection ping

Introduction

In this page you can find the example usage for org.springframework.data.redis.connection StringRedisConnection ping.

Prototype

@Nullable
String ping();

Source Link

Document

Test connection.

Usage

From source file:org.springframework.data.redis.connection.lettuce.LettuceConnectionFactoryTests.java

@Test // DATAREDIS-462
public void factoryWorksWithoutClientResources() {

    LettuceConnectionFactory factory = new LettuceConnectionFactory();
    factory.setShutdownTimeout(0);// w w  w .  ja  v  a 2s. c  om
    factory.afterPropertiesSet();

    ConnectionFactoryTracker.add(factory);

    StringRedisConnection connection = new DefaultStringRedisConnection(factory.getConnection());

    try {
        assertThat(connection.ping(), is(equalTo("PONG")));
    } finally {
        connection.close();
    }
}