I have tried doing the health check of Redis Server using the below code:
Jedis jedis = null;
try {
jedis = new Jedis(System.getenv(REDIS_END_POINT), Integer.parseInt(System.getenv(REDIS_PORT)),true);
System.out.println(jedis);
if (jedis.ping().equalsIgnoreCase(PONG)) {
responseFlag = true;
LOGGER.info("Redis Connection established");
} else {
responseFlag = false;
LOGGER.error("The HealthCheck for this service returned: " + jedis.ping());
}
} catch (Exception exception) {
responseFlag = false;
LOGGER.error("Exception occurred " + exception.getMessage());
}
This response flag value is my return value of the method. However, when I am trying to test the code in main method, it throws exception javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
.
Note: In my Config file I have set the necessary environment variables.