public StartLineTests() { MemoryPool = MemoryPoolFactory.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); }
public void Setup() { var memoryPool = MemoryPoolFactory.Create(); var options = new PipeOptions(memoryPool, readerScheduler: PipeScheduler.Inline, writerScheduler: PipeScheduler.Inline, useSynchronizationContext: false); var pair = DuplexPipe.CreateConnectionPair(options, options); var serviceContext = new ServiceContext { ServerOptions = new KestrelServerOptions(), HttpParser = NullParser <Http1ParsingHandler> .Instance }; var http1Connection = new Http1Connection(context: new HttpConnectionContext { ServiceContext = serviceContext, ConnectionFeatures = new FeatureCollection(), MemoryPool = memoryPool, TimeoutControl = new TimeoutControl(timeoutHandler: null), Transport = pair.Transport }); http1Connection.Reset(); Connection = http1Connection; }
public Http1ConnectionTests() { _pipelineFactory = MemoryPoolFactory.Create(); var options = new PipeOptions(_pipelineFactory, readerScheduler: PipeScheduler.Inline, writerScheduler: PipeScheduler.Inline, useSynchronizationContext: false); var pair = DuplexPipe.CreateConnectionPair(options, options); _transport = pair.Transport; _application = pair.Application; var connectionFeatures = new FeatureCollection(); connectionFeatures.Set(Mock.Of <IConnectionLifetimeFeature>()); _serviceContext = new TestServiceContext() { Scheduler = PipeScheduler.Inline }; _timeoutControl = new Mock <ITimeoutControl>(); _http1ConnectionContext = new HttpConnectionContext { ServiceContext = _serviceContext, ConnectionContext = Mock.Of <ConnectionContext>(), ConnectionFeatures = connectionFeatures, MemoryPool = _pipelineFactory, TimeoutControl = _timeoutControl.Object, Transport = pair.Transport }; _http1Connection = new TestHttp1Connection(_http1ConnectionContext); _http1Connection.Reset(); }
public TestInput() { _memoryPool = MemoryPoolFactory.Create(); var options = new PipeOptions(pool: _memoryPool, readerScheduler: PipeScheduler.Inline, writerScheduler: PipeScheduler.Inline, useSynchronizationContext: false); var pair = DuplexPipe.CreateConnectionPair(options, options); Transport = pair.Transport; Application = pair.Application; var connectionFeatures = new FeatureCollection(); connectionFeatures.Set(Mock.Of <IConnectionLifetimeFeature>()); Http1ConnectionContext = new HttpConnectionContext { ServiceContext = new TestServiceContext(), ConnectionContext = Mock.Of <ConnectionContext>(), ConnectionFeatures = connectionFeatures, Transport = Transport, MemoryPool = _memoryPool, TimeoutControl = Mock.Of <ITimeoutControl>() }; Http1Connection = new Http1Connection(Http1ConnectionContext); Http1Connection.HttpResponseControl = Mock.Of <IHttpResponseControl>(); Http1Connection.Reset(); }
public void InitialDictionaryIsEmpty() { using (var memoryPool = MemoryPoolFactory.Create()) { var options = new PipeOptions(memoryPool, readerScheduler: PipeScheduler.Inline, writerScheduler: PipeScheduler.Inline, useSynchronizationContext: false); var pair = DuplexPipe.CreateConnectionPair(options, options); var http1ConnectionContext = new HttpConnectionContext { ServiceContext = new TestServiceContext(), ConnectionFeatures = new FeatureCollection(), MemoryPool = memoryPool, Transport = pair.Transport, TimeoutControl = null }; var http1Connection = new Http1Connection(http1ConnectionContext); http1Connection.Reset(); IDictionary <string, StringValues> headers = http1Connection.ResponseHeaders; Assert.Equal(0, headers.Count); Assert.False(headers.IsReadOnly); } }
public HttpProtocolFeatureCollection() { var memoryPool = MemoryPoolFactory.Create(); var options = new PipeOptions(memoryPool, readerScheduler: PipeScheduler.Inline, writerScheduler: PipeScheduler.Inline, useSynchronizationContext: false); var pair = DuplexPipe.CreateConnectionPair(options, options); var serviceContext = new ServiceContext { DateHeaderValueManager = new DateHeaderValueManager(), ServerOptions = new KestrelServerOptions(), Log = new MockTrace(), HttpParser = new HttpParser <Http1ParsingHandler>() }; var http1Connection = new Http1Connection(new HttpConnectionContext { ServiceContext = serviceContext, ConnectionFeatures = new FeatureCollection(), MemoryPool = memoryPool, Transport = pair.Transport }); http1Connection.Reset(); _collection = http1Connection; }
public void Setup() { _memoryPool = MemoryPoolFactory.Create(); var options = new PipeOptions(_memoryPool, readerScheduler: PipeScheduler.Inline, writerScheduler: PipeScheduler.Inline, useSynchronizationContext: false); var pair = DuplexPipe.CreateConnectionPair(options, options); var serviceContext = new ServiceContext { DateHeaderValueManager = new DateHeaderValueManager(), ServerOptions = new KestrelServerOptions(), Log = new MockTrace(), HttpParser = new HttpParser <Http1ParsingHandler>() }; var http1Connection = new Http1Connection(new HttpConnectionContext { ServiceContext = serviceContext, ConnectionFeatures = new FeatureCollection(), MemoryPool = _memoryPool, Transport = pair.Transport, TimeoutControl = new TimeoutControl(timeoutHandler: null) }); http1Connection.Reset(); Http1Connection = http1Connection; Pipe = new Pipe(new PipeOptions(_memoryPool)); }
public void Setup() { _memoryPool = MemoryPoolFactory.Create(); var pipe = new Pipe(new PipeOptions(_memoryPool)); _reader = pipe.Reader; _writer = pipe.Writer; }
public LibuvOutputConsumerTests() { _memoryPool = MemoryPoolFactory.Create(); _mockLibuv = new MockLibuv(); var context = new TestLibuvTransportContext(); _libuvThread = new LibuvThread(_mockLibuv, context, maxLoops: 1); _libuvThread.StartAsync().Wait(); }
public void Setup() { var memoryPool = MemoryPoolFactory.Create(); var options = new PipeOptions(memoryPool, readerScheduler: PipeScheduler.Inline, writerScheduler: PipeScheduler.Inline, useSynchronizationContext: false); var pair = DuplexPipe.CreateConnectionPair(options, options); var serviceContext = new ServiceContext { DateHeaderValueManager = _dateHeaderValueManager, ServerOptions = new KestrelServerOptions(), Log = new MockTrace(), HttpParser = new HttpParser <Http1ParsingHandler>() }; var http1Connection = new Http1Connection(new HttpConnectionContext { ServiceContext = serviceContext, ConnectionFeatures = new FeatureCollection(), MemoryPool = memoryPool, Transport = pair.Transport }); http1Connection.Reset(); serviceContext.DateHeaderValueManager.OnHeartbeat(DateTimeOffset.UtcNow); _responseHeadersDirect = (HttpResponseHeaders)http1Connection.ResponseHeaders; var context = new DefaultHttpContext(http1Connection); _response = new DefaultHttpResponse(context); switch (Type) { case BenchmarkTypes.ContentLengthNumeric: ContentLengthNumeric(1); break; case BenchmarkTypes.ContentLengthString: ContentLengthString(1); break; case BenchmarkTypes.Plaintext: Plaintext(1); break; case BenchmarkTypes.Common: Common(1); break; case BenchmarkTypes.Unknown: Unknown(1); break; } }
public void GlobalSetup() { _memoryPool = MemoryPoolFactory.Create(); _http1Connection = MakeHttp1Connection(); }
public OutputProducerTests() { _memoryPool = MemoryPoolFactory.Create(); }
public void Setup() { _memoryPool = MemoryPoolFactory.Create(); _pipe = new Pipe(new PipeOptions(_memoryPool)); }