public void BeginSendRequest(Message message, TimeSpan timeout) { this.timeoutHelper = new TimeoutHelper(timeout); this.message = message; bool completeSelf = false; bool success = false; try { try { IAsyncResult result = connectionPoolHelper.BeginEstablishConnection(timeoutHelper.RemainingTime(), onEstablishConnection, this); if (result.CompletedSynchronously) { completeSelf = HandleEstablishConnection(result); } } catch (TimeoutException exception) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( new TimeoutException(SR.GetString(SR.TimeoutOnRequest, timeout), exception)); } success = true; } finally { if (!success) { Cleanup(); } } if (completeSelf) { base.Complete(true); } }