コード例 #1
0
        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;
            }
        }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
 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;
     }
 }
コード例 #4
0
 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;
     }
 }