public async Task SingletonServiceTest()
        {
            var serverBuilder = new RpcServiceDefinitionsBuilder();

            serverBuilder.RegisterService <ISimpleService>();

            var(host, connection) = this.CreateServerAndConnection(serverBuilder);
            var servicePublisher = host.ServicePublisher;

            host.Start();

            try
            {
                var serviceImpl = new TestSimpleServiceImpl();
                using (servicePublisher.PublishSingleton <ISimpleService>(serviceImpl))
                {
                    var clientService = connection.GetServiceSingleton <ISimpleService>();

                    int res = await clientService.AddAsync(8, 9);

                    Assert.AreEqual(8 + 9, res);
                }
            }
            finally
            {
                await host.ShutdownAsync();
            }
        }
        public async Task MultiSingletonServicesTest()
        {
            var serverBuilder = new RpcServiceDefinitionsBuilder();

            serverBuilder.RegisterService <ISimpleService>();
            serverBuilder.RegisterService <IBlockingService>();

            var(host, connection) = this.CreateServerAndConnection(serverBuilder);
            var servicePublisher = host.ServicePublisher;

            host.Start();

            try
            {
                var simpleServiceImpl   = new TestSimpleServiceImpl();
                var blockingServiceImpl = new TestBlockingServiceImpl();
                using (servicePublisher.PublishSingleton <ISimpleService>(simpleServiceImpl))
                {
                    using (servicePublisher.PublishSingleton <IBlockingService>(blockingServiceImpl))
                    {
                        var clientService = connection.GetServiceSingleton <ISimpleService>();
                        _ = connection.GetServiceSingleton <IBlockingService>();
                        var clientService2 = connection.GetServiceSingleton <ISimpleService>();
                        Assert.AreSame(clientService, clientService2);

                        int res = await clientService.AddAsync(8, 9);

                        Assert.AreEqual(8 + 9, res);

                        int res2 = await clientService.AddAsync(12, 13);

                        Assert.AreEqual(12 + 13, res2);
                    }
                }
            }
            finally
            {
                await host.ShutdownAsync();
            }
        }