private void scheduleCheck(final ClientConnectionsEntry entry) {

    connectionManager.getConnectionEventsHub().fireDisconnect(entry.getClient().getAddr());

    connectionManager.newTimeout(
        new TimerTask() {
          @Override
          public void run(Timeout timeout) throws Exception {
            if (entry.getFreezeReason() != FreezeReason.RECONNECT || !entry.isFreezed()) {
              return;
            }

            Future<RedisConnection> connectionFuture = entry.getClient().connectAsync();
            connectionFuture.addListener(
                new FutureListener<RedisConnection>() {
                  @Override
                  public void operationComplete(Future<RedisConnection> future) throws Exception {
                    if (entry.getFreezeReason() != FreezeReason.RECONNECT || !entry.isFreezed()) {
                      return;
                    }

                    if (!future.isSuccess()) {
                      scheduleCheck(entry);
                      return;
                    }
                    final RedisConnection c = future.getNow();
                    if (!c.isActive()) {
                      c.closeAsync();
                      scheduleCheck(entry);
                      return;
                    }

                    final FutureListener<String> pingListener =
                        new FutureListener<String>() {
                          @Override
                          public void operationComplete(Future<String> future) throws Exception {
                            try {
                              if (entry.getFreezeReason() != FreezeReason.RECONNECT
                                  || !entry.isFreezed()) {
                                return;
                              }

                              if (future.isSuccess() && "PONG".equals(future.getNow())) {
                                entry.resetFailedAttempts();
                                Promise<Void> promise = connectionManager.newPromise();
                                promise.addListener(
                                    new FutureListener<Void>() {
                                      @Override
                                      public void operationComplete(Future<Void> future)
                                          throws Exception {
                                        if (entry.getNodeType() == NodeType.SLAVE) {
                                          masterSlaveEntry.slaveUp(
                                              entry.getClient().getAddr().getHostName(),
                                              entry.getClient().getAddr().getPort(),
                                              FreezeReason.RECONNECT);
                                          log.info(
                                              "slave {} successfully reconnected",
                                              entry.getClient().getAddr());
                                        } else {
                                          synchronized (entry) {
                                            if (entry.getFreezeReason() == FreezeReason.RECONNECT) {
                                              entry.setFreezed(false);
                                              entry.setFreezeReason(null);
                                              log.info(
                                                  "host {} successfully reconnected",
                                                  entry.getClient().getAddr());
                                            }
                                          }
                                        }
                                      }
                                    });
                                initConnections(entry, promise, false);
                              } else {
                                scheduleCheck(entry);
                              }
                            } finally {
                              c.closeAsync();
                            }
                          }
                        };

                    if (entry.getConfig().getPassword() != null) {
                      Future<Void> temp = c.async(RedisCommands.AUTH, config.getPassword());

                      FutureListener<Void> listener =
                          new FutureListener<Void>() {
                            @Override
                            public void operationComplete(Future<Void> future) throws Exception {
                              ping(c, pingListener);
                            }
                          };

                      temp.addListener(listener);
                    } else {
                      ping(c, pingListener);
                    }
                  }
                });
          }
        },
        config.getReconnectionTimeout(),
        TimeUnit.MILLISECONDS);
  }