Пример #1
0
        public async Task TestHandlerRegister()
        {
            CountdownEvent latch = new CountdownEvent(1);
            AtomicReference <Exception> error = new AtomicReference <Exception>();
            var group = new DefaultEventLoopGroup(1);

            try
            {
                ServerBootstrap sb = new ServerBootstrap();
                sb.Channel <LocalServerChannel>()
                .Group(group)
                .ChildHandler(new ChannelHandlerAdapter())
                .Handler(new TestRegisterHandler(latch, error));

                await sb.RegisterAsync();

                latch.Wait();
                Assert.Null(error.Value);
            }
            finally
            {
                await group.ShutdownGracefullyAsync(TimeSpan.FromMilliseconds(100), TimeSpan.FromSeconds(5));
            }
        }