Ejemplo n.º 1
0
 public void ConnectAndDisconnect()
 {
     const int port = 12345;
     var host = new WireBusHost(IPAddress.Loopback, port);
     host.Start();
     var serverTask = host.AcceptWireBusAsync();
     var client = WireBus.Connect(IPAddress.Loopback, port);
     serverTask.Wait();
     var server = serverTask.Result;
     var messageTask = client.ReceiveAsync<TestMessage>();
     server.Disconnect();
     host.Stop();
     try
     {
         try
         {
             messageTask.Wait();
         }
         catch(AggregateException ae)
         {
             throw ae.Flatten().InnerException;
         }
     }
     catch (InvalidEnvelopeException)
     {
         return;
     }
     Assert.Fail();
 }
Ejemplo n.º 2
0
 public void Connect()
 {
     const int port = 12345;
     var host = new WireBusHost(IPAddress.Loopback, port);
     host.Start();
     var serverTask = host.AcceptWireBusAsync();
     var client = WireBus.Connect(IPAddress.Loopback, port);
     serverTask.Wait();
     host.Stop();
 }