// Check if the connection to the server was done successfully.
if (!future.isSuccess()) {
logger.error("Error connecting to host: " + host);
// If we were not able to connect to the host, it could be down.
ByteString hostString = ByteString.copyFromUtf8(HedwigSocketAddress.sockAddrStr(host));
if (pubSubData.connectFailedServers != null && pubSubData.connectFailedServers.contains(hostString)) {
// We've already tried to connect to this host before so just
// invoke the operationFailed callback.
logger.error("Error connecting to host more than once so just invoke the operationFailed callback!");
pubSubData.callback.operationFailed(pubSubData.context, new CouldNotConnectException(