// ----------
// Closing the session only when it is expected allows the errors to be processed
// Calling this here will prevent failover. So we should do this for all exceptions
// that should never cause failover. Such as authentication errors.
session.channelClosed(channelId, errorCode, String.valueOf(reason));
}
}