public async Task BlockingServiceCallTest()
        {
            var serviceRegistrator = new RpcServiceDefinitionsBuilder();

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

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

            //RpcServerId rpcServerId = servicePublisher.HostId;
            host.Start();

            try
            {
                var serviceImpl = new TestBlockingSimpleServiceImpl();
                using (var publishScope = servicePublisher.PublishInstance(serviceImpl))
                {
                    var objectId = publishScope.Value.ObjectId;

                    var clientService = connection.GetServiceInstance <IBlockingServiceClient>(objectId);

                    int blockingRes = clientService.Add(12, 13);
                    Assert.AreEqual(12 + 13, blockingRes);

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

                    Assert.AreEqual(8 + 9, asyncRes);

                    clientService.Value = 123.45;
                    Assert.AreEqual(123.45, await clientService.GetValueAsync());

                    await clientService.SetValueAsync(543.21).ConfigureAwait(false);

                    Assert.AreEqual(543.21, clientService.Value);

                    await connection.ShutdownAsync();
                }
            }
            finally
            {
                await host.ShutdownAsync();
            }
        }
        public async Task MultiInstanceServicesTest()
        {
            var serviceRegistrator = new RpcServiceDefinitionsBuilder();

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

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

            //RpcServerId rpcServerId = servicePublisher.HostId;
            host.Start();

            try
            {
                var serviceImpl = new TestBlockingSimpleServiceImpl();
                using (var publishScope = servicePublisher.PublishInstance(serviceImpl))
                {
                    var objectId = publishScope.Value.ObjectId;

                    var blockingService = connection.GetServiceInstance <IBlockingServiceClient>(objectId);
                    var simpleService   = connection.GetServiceInstance <ISimpleService>(objectId);
                    // Service proxies should be equal, but not necessarily the same
                    Assert.AreEqual(blockingService, simpleService);

                    var blockingService2 = connection.GetServiceInstance <IBlockingServiceClient>(objectId);
                    // Service proxies for the object and service should be the same
                    Assert.AreSame(blockingService, blockingService2);

                    await connection.ShutdownAsync().DefaultTimeout();
                }
            }
            finally
            {
                await host.ShutdownAsync().DefaultTimeout();
            }
        }