public TransportConnectionFactory(
     ITransmissionConnectionFactory transmissionConnectionFactory,
     ITransportProtocolSerializationProvider serializationProvider)
 {
     _transmissionConnectionFactory = transmissionConnectionFactory;
     _serializer   = serializationProvider.GetSerializer();
     _deserializer = serializationProvider.GetDeserializer(TransportHeaderPool.Instance);
 }
Пример #2
0
 private Task RunSenderTaskAsync(ITransmissionConnectionFactory streamFactory, Func <IMessagingSendProcessor, Task> action)
 {
     return(TaskRunner.RunInBackground(async() =>
     {
         using (var serverStream = await streamFactory.CreateAsync().ConfigureAwait(false))
         {
             var sender = new MessagingSendProcessor(serverStream, SerializationProvider.GetSerializer());
             await action(sender).ConfigureAwait(false);
             sender.Out.TryComplete();
             await sender.Out.Completion.ConfigureAwait(false);
             Log.Trace("Waiting for completion of connection {0}", serverStream.Id);
             await serverStream.Completion.ConfigureAwait(false);
         }
     }));
 }
Пример #3
0
 private Task RunReceiverTaskAsync(ITransmissionConnectionFactory streamFactory, Func <IMessagingReceiveProcessor, Task> action)
 {
     return(TaskRunner.RunInBackground(async() =>
     {
         using (var serverStream = await streamFactory.CreateAsync().ConfigureAwait(false))
         {
             var receiver = new MessagingReceiveProcessor(serverStream, SerializationProvider.GetDeserializer(TransportHeaderPool.Instance));
             await action(receiver).ConfigureAwait(false);
             await receiver.In.Completion.ConfigureAwait(false);
             Log.Trace("Completing server stream for connection {0}", serverStream.Id);
             serverStream.Out.TryComplete();
             await serverStream.Completion.ConfigureAwait(false);
         }
     }));
 }
Пример #4
0
 public MessagingTests()
 {
     _server = RegisterDisposable(new PipeTransmissionServer(Directory.GetCurrentDirectory()));
     _server.StartAsync().GetResult();
     _clientFactory = new PipeTransmissionClient(Directory.GetCurrentDirectory());
 }