Esempio n. 1
0
        public StartLineTests()
        {
            MemoryPool = KestrelMemoryPool.Create();
            var options = new PipeOptions(MemoryPool, readerScheduler: PipeScheduler.Inline, writerScheduler: PipeScheduler.Inline, useSynchronizationContext: false);
            var pair    = DuplexPipe.CreateConnectionPair(options, options);

            Transport = pair.Transport;

            var serviceContext = new ServiceContext
            {
                ServerOptions = new KestrelServerOptions(),
                Log           = _trace,
                HttpParser    = new HttpParser <Http1ParsingHandler>()
            };

            Http1Connection = new Http1Connection(context: new HttpConnectionContext
            {
                ServiceContext     = serviceContext,
                ConnectionFeatures = new FeatureCollection(),
                MemoryPool         = MemoryPool,
                Transport          = Transport,
                TimeoutControl     = new TimeoutControl(timeoutHandler: null)
            });

            Parser         = new HttpParser <Http1ParsingHandler>(showErrorDetails: true);
            ParsingHandler = new Http1ParsingHandler(Http1Connection);
        }
Esempio n. 2
0
    public StartLineTests()
    {
        MemoryPool = PinnedBlockMemoryPoolFactory.Create();
        var options = new PipeOptions(MemoryPool, readerScheduler: PipeScheduler.Inline, writerScheduler: PipeScheduler.Inline, useSynchronizationContext: false);
        var pair    = DuplexPipe.CreateConnectionPair(options, options);

        Transport = pair.Transport;

        var serviceContext = TestContextFactory.CreateServiceContext(
            serverOptions: new KestrelServerOptions(),
            httpParser: new HttpParser <Http1ParsingHandler>());

        var connectionContext = TestContextFactory.CreateHttpConnectionContext(
            serviceContext: serviceContext,
            connectionContext: Mock.Of <ConnectionContext>(),
            transport: Transport,
            timeoutControl: new TimeoutControl(timeoutHandler: null),
            memoryPool: MemoryPool,
            connectionFeatures: new FeatureCollection());

        Http1Connection = new Http1Connection(connectionContext);

        Parser         = new HttpParser <Http1ParsingHandler>(showErrorDetails: true);
        ParsingHandler = new Http1ParsingHandler(Http1Connection);
    }