Ejemplo n.º 1
0
        protected override void InitChannel(T channel)
        {
            var pipeline   = channel.Pipeline;
            var tlsHandler = NewTlsHandler(_targetHost, _certificate);

            if (tlsHandler != null)
            {
                pipeline.AddLast(tlsHandler);
            }

            pipeline.AddLast(new LoggingHandler(LogLevel.TRACE));

            pipeline.AddLast(_eventLoopGroupFactory.GetOrCreateHandlerWorkerEventLoopGroup(), _handlerGenerationFunction().ToArray());
        }
Ejemplo n.º 2
0
        public async Task Can_Dispose_All_Event_Loops()
        {
            _eventFactory = new TcpClientEventLoopGroupFactory(_eventLoopGroupFactoryConfiguration);
            IEventLoopGroup[] eventLoops =
            {
                _eventFactory.GetOrCreateHandlerWorkerEventLoopGroup(),
                _eventFactory.GetOrCreateSocketIoEventLoopGroup()
            };

            _eventFactory.Dispose();

            while (!eventLoops.All(x => x.IsShutdown))
            {
                await Task.Delay(100).ConfigureAwait(false);
            }

            eventLoops.ToList().ForEach(eventLoop => eventLoop.IsShutdown.Should().BeTrue());
        }
Ejemplo n.º 3
0
 public void Can_Spawn_Correct_Amount_Of_Tcp_Client_Event_Loops()
 {
     _eventFactory = new TcpClientEventLoopGroupFactory(_eventLoopGroupFactoryConfiguration);
     AssertEventLoopSize(_eventFactory.GetOrCreateHandlerWorkerEventLoopGroup(), ExpectedTcpClientThreads);
     AssertEventLoopSize(_eventFactory.GetOrCreateSocketIoEventLoopGroup(), ExpectedDefaultEventLoopThreadCount);
 }