示例#1
0
        public Http3HttpProtocolFeatureCollectionTests()
        {
            var streamContext = TestContextFactory.CreateHttp3StreamContext(transport: DuplexPipe.CreateConnectionPair(new PipeOptions(), new PipeOptions()).Application);

            var http3Stream = new TestHttp3Stream(streamContext);

            http3Stream.Reset();
            _http3Collection = http3Stream;
        }
示例#2
0
    public Http3HttpProtocolFeatureCollectionTests()
    {
        var connectionFeatures = new TestConnectionFeatures().FeatureCollection;

        var streamContext = TestContextFactory.CreateHttp3StreamContext(
            transport: DuplexPipe.CreateConnectionPair(new PipeOptions(), new PipeOptions()).Application,
            connectionFeatures: connectionFeatures);

        var http3Stream = new TestHttp3Stream();

        http3Stream.Initialize(streamContext);
        _http3Collection = http3Stream;
    }
    public static WebTransportStream CreateStream(WebTransportStreamType type, Memory <byte>?memory = null)
    {
        var features = new FeatureCollection();

        features.Set <IStreamIdFeature>(new StreamId(streamCounter++));
        features.Set <IStreamDirectionFeature>(new DefaultStreamDirectionFeature(type != WebTransportStreamType.Output, type != WebTransportStreamType.Input));
        features.Set(Mock.Of <IConnectionItemsFeature>());
        features.Set(Mock.Of <IProtocolErrorCodeFeature>());

        var writer = new HttpResponsePipeWriter(new StreamWriterControl(memory));

        writer.StartAcceptingWrites();
        var transport = new DuplexPipe(new StreamReader(memory), writer);

        return(new WebTransportStream(TestContextFactory.CreateHttp3StreamContext("id", null, new TestServiceContext(), features, null, null, null, transport), type));
    }