private void OpenHelper(CancellationToken cancellationToken) { var helper = new OpenConnectionHelper(this); try { helper.OpeningConnection(); _stream = _streamFactory.CreateStream(_endPoint, cancellationToken); helper.InitializingConnection(); _description = _connectionInitializer.InitializeConnection(this, cancellationToken); helper.OpenedConnection(); } catch (Exception ex) { var wrappedException = WrapException(ex, "opening a connection to the server"); helper.FailedOpeningConnection(wrappedException); throw wrappedException; } }
private async Task OpenHelperAsync(CancellationToken cancellationToken) { var helper = new OpenConnectionHelper(this); try { helper.OpeningConnection(); _stream = await _streamFactory.CreateStreamAsync(_endPoint, cancellationToken).ConfigureAwait(false); helper.InitializingConnection(); _description = await _connectionInitializer.InitializeConnectionAsync(this, cancellationToken).ConfigureAwait(false); helper.OpenedConnection(); } catch (Exception ex) { var wrappedException = WrapException(ex, "opening a connection to the server"); helper.FailedOpeningConnection(wrappedException); throw wrappedException; } }
private async Task OpenHelperAsync(CancellationToken cancellationToken) { var helper = new OpenConnectionHelper(this); try { helper.OpeningConnection(); _stream = await _streamFactory.CreateStreamAsync(_endPoint, cancellationToken).ConfigureAwait(false); helper.InitializingConnection(); _description = await _connectionInitializer.InitializeConnectionAsync(this, cancellationToken).ConfigureAwait(false); helper.OpenedConnection(); } catch (Exception ex) { var wrappedException = WrapException(ex, "opening a connection to the server"); helper.FailedOpeningConnection(wrappedException); throw wrappedException; } }
private void OpenHelper(CancellationToken cancellationToken) { var helper = new OpenConnectionHelper(this); try { helper.OpeningConnection(); _stream = _streamFactory.CreateStream(_endPoint, cancellationToken); helper.InitializingConnection(); _description = _connectionInitializer.InitializeConnection(this, cancellationToken); helper.OpenedConnection(); } catch (Exception ex) { var wrappedException = WrapException(ex, "opening a connection to the server"); helper.FailedOpeningConnection(wrappedException); throw wrappedException; } }