Пример #1
0
        private async Task <GenericServer> RunLocalServer(AvroProtocol protocol, LocalTranceiver tranceiver, CancellationToken token)
        {
            var server = new GenericServer(protocol, tranceiver);

            await RunGenericServer(server, token);

            return(server);
        }
Пример #2
0
 public void TestHelloWorldLocal()
 {
     using (var cancellationTokenSource = new CancellationTokenSource())
     {
         var tranceiver     = new LocalTranceiver();
         var serverTask     = Task.Factory.StartNew(() => RunLocalServer(HELLO_PROTOCOL, tranceiver, cancellationTokenSource.Token));
         var client         = ConnectLocalClient(HELLO_PROTOCOL, tranceiver, cancellationTokenSource.Token);
         var responseRecord = RunGenericClient(client, cancellationTokenSource.Token).Result;
         cancellationTokenSource.Cancel();
         Task.WaitAll(serverTask);
         serverTask.Result.Result.Close();
         Assert.AreEqual("World!", responseRecord[0]);
     }
 }
Пример #3
0
 private GenericClient ConnectLocalClient(AvroProtocol protocol, LocalTranceiver tranceiver, CancellationToken token)
 {
     return(new GenericClient(protocol, tranceiver));
 }