コード例 #1
0
        protected internal override ILightweightRpcListener CreateListener(IRpcConnectionHandler connectionHandler, int maxRequestSize, int maxResponseSize)
        {
            var listener = new TestDiscoveryListener(this, connectionHandler);

            this.listeners.Add(listener);
            return(listener);
        }
コード例 #2
0
        public async Task ServerEndPoint_Should_CreateStartAndStop_Listener()
        {
            var server         = new LightweightRpcServer();
            var connectionInfo = new RpcConnectionInfo(new Uri("test://test"));
            var endPoint       = new TestDiscoveryEndPoint(connectionInfo);

            server.AddEndPoint(endPoint);

            server.Start();

            TestDiscoveryListener listener = endPoint.Listeners.FirstOrDefault();

            Assert.NotNull(listener);

            Assert.IsTrue(listener.IsListening);
            await server.ShutdownAsync();

            Assert.IsTrue(listener.IsStopped);

            server.Dispose();
            Assert.IsTrue(listener.IsDisposed);
        }