@Override
 public void onConnectionClose(ClientConnection clientConnection) {
   Address endpoint = clientConnection.getRemoteEndpoint();
   if (endpoint != null) {
     connections.remove(clientConnection.getRemoteEndpoint());
     ownerConnectionFuture.closeIfAddressMatches(endpoint);
   }
 }
  @Override
  public void onDetectingUnresponsiveConnection(ClientConnection connection) {
    if (smartRouting) {
      // closing the owner connection if unresponsive so that it can be switched to a healthy one.
      ownerConnectionFuture.closeIfAddressMatches(connection.getEndPoint());
      // we do not close connection itself since we will continue to send heartbeat ping to this
      // connection.
      // IOUtil.closeResource(connection);
      return;
    }

    // close both owner and operation connection
    ownerConnectionFuture.close();
    IOUtil.closeResource(connection);
  }