示例#1
0
        public async Task InitializeConnectionAsync(RequestDelegate application)
        {
            MultiplexedConnectionContext = new TestMultiplexedConnectionContext(this)
            {
                ConnectionId = "TEST"
            };

            var httpConnectionContext = new HttpMultiplexedConnectionContext(
                connectionId: MultiplexedConnectionContext.ConnectionId,
                HttpProtocols.Http3,
                altSvcHeader: null,
                connectionContext: MultiplexedConnectionContext,
                connectionFeatures: MultiplexedConnectionContext.Features,
                serviceContext: _serviceContext,
                memoryPool: _memoryPool,
                localEndPoint: null,
                remoteEndPoint: null);

            httpConnectionContext.TimeoutControl = _timeoutControl;

            _httpConnection = new HttpConnection(httpConnectionContext);
            _httpConnection.Initialize(Connection);

            // ProcessRequestAsync will create the Http3Connection
            _connectionTask = _httpConnection.ProcessRequestsAsync(new DummyApplication(application));

            Connection = (Http3Connection)_httpConnection._requestProcessor;
            Connection._streamLifetimeHandler = new LifetimeHandlerInterceptor(Connection, this);

            await GetInboundControlStream();
        }
示例#2
0
        protected async Task InitializeConnectionAsync(RequestDelegate application)
        {
            MultiplexedConnectionContext = new TestMultiplexedConnectionContext(this);

            var httpConnectionContext = new HttpMultiplexedConnectionContext(
                connectionId: "TestConnectionId",
                connectionContext: MultiplexedConnectionContext,
                connectionFeatures: MultiplexedConnectionContext.Features,
                serviceContext: _serviceContext,
                memoryPool: _memoryPool,
                localEndPoint: null,
                remoteEndPoint: null);

            httpConnectionContext.TimeoutControl = _mockTimeoutControl.Object;

            _httpConnection = new HttpConnection(httpConnectionContext);
            _httpConnection.Initialize(Connection);
            _mockTimeoutHandler.Setup(h => h.OnTimeout(It.IsAny <TimeoutReason>()))
            .Callback <TimeoutReason>(r => _httpConnection.OnTimeout(r));

            // ProcessRequestAsync will create the Http3Connection
            _connectionTask = _httpConnection.ProcessRequestsAsync(new DummyApplication(application));

            Connection = (Http3Connection)_httpConnection._requestProcessor;
            Connection._streamLifetimeHandler = new LifetimeHandlerInterceptor(Connection, this);

            await GetInboundControlStream();
        }
示例#3
0
        protected void CreateConnection()
        {
            MultiplexedConnectionContext = new TestMultiplexedConnectionContext(this);

            var httpConnectionContext = new Http3ConnectionContext(
                connectionId: "TestConnectionId",
                connectionContext: MultiplexedConnectionContext,
                connectionFeatures: MultiplexedConnectionContext.Features,
                serviceContext: _serviceContext,
                memoryPool: _memoryPool,
                localEndPoint: null,
                remoteEndPoint: null);

            httpConnectionContext.TimeoutControl = _mockTimeoutControl.Object;

            Connection = new Http3Connection(httpConnectionContext);
            _mockTimeoutHandler.Setup(h => h.OnTimeout(It.IsAny <TimeoutReason>()))
            .Callback <TimeoutReason>(r => Connection.OnTimeout(r));
        }
示例#4
0
        protected void CreateConnection()
        {
            var limits = _serviceContext.ServerOptions.Limits;

            var features = new FeatureCollection();

            _multiplexedContext = new TestMultiplexedConnectionContext(this);

            var httpConnectionContext = new Http3ConnectionContext
            {
                ConnectionContext  = _multiplexedContext,
                ConnectionFeatures = features,
                ServiceContext     = _serviceContext,
                MemoryPool         = _memoryPool,
                TimeoutControl     = _mockTimeoutControl.Object
            };

            _connection = new Http3Connection(httpConnectionContext);
            _mockTimeoutHandler.Setup(h => h.OnTimeout(It.IsAny <TimeoutReason>()))
            .Callback <TimeoutReason>(r => _connection.OnTimeout(r));
        }