private Exception WrappedException(Exception ex)
{
Exception wrappedException;
if (_disposeToken.IsCancellationRequested)
wrappedException = new ObjectDisposedException(string.Format("Object is disposing (KafkaTcpSocket for endpoint: {0})", Endpoint));
else
wrappedException = new BrokerConnectionException(string.Format("Lost connection to server: {0}", _endpoint), _endpoint, ex);
return wrappedException;
}