コード例 #1
0
ファイル: GoodbyeTests.cs プロジェクト: uzbekdev1/WampSharp
        public async Task InMemoryTest()
        {
            var transport = new InMemoryTransport(Scheduler.Default);
            var binding   = new JTokenJsonBinding();
            var realm     = "some.realm";

            var router = new WampHost();

            router.RegisterTransport(transport, new[] { binding });
            router.Open();

            var calleeConnection       = transport.CreateClientConnection(binding, Scheduler.Default);
            WampChannelFactory factory = new WampChannelFactory();

            var callee = factory.CreateChannel(realm, calleeConnection, binding);
            await callee.Open();

            await callee.RealmProxy.Services.RegisterCallee(new WampTest());


            var callerConnection = transport.CreateClientConnection(binding, Scheduler.Default);
            var caller           = factory.CreateChannel(realm, callerConnection, binding);
            await caller.Open();

            var proxy  = caller.RealmProxy.Services.GetCalleeProxy <IWampTest>();
            var result = await proxy.Echo("1");

            Assert.That(result, Is.EqualTo("1"));

            await caller.Close(WampErrors.CloseNormal, new GoodbyeDetails());

            await callee.Close(WampErrors.CloseNormal, new GoodbyeDetails());

            router.Dispose();
        }
コード例 #2
0
 public void Dispose()
 {
     _router.Dispose();
 }