示例#1
0
            internal ConnectionTest()
            {
                var cancellationTokenSource = new CancellationTokenSource();

                _simulatedIpc = SimulatedIpc.Create(cancellationTokenSource.Token);
                var sender     = new Sender(_simulatedIpc.RemoteStandardOutputForRemote);
                var receiver   = new StandardInputReceiver(_simulatedIpc.RemoteStandardInputForRemote);
                var dispatcher = new MessageDispatcher(new RequestHandlers(), new RequestIdGenerator());
                var options    = ConnectionOptions.CreateDefault();

                Connection = new Connection(dispatcher, sender, receiver, options);
            }
示例#2
0
 internal ConnectAsyncTest(ConnectionOptions localToRemoteOptions, ConnectionOptions remoteToLocalOptions)
 {
     _combinedCancellationTokenSource = new CancellationTokenSource();
     _simulatedIpc           = SimulatedIpc.Create(_combinedCancellationTokenSource.Token);
     _remoteSender           = new Sender(_simulatedIpc.RemoteStandardOutputForRemote);
     _remoteReceiver         = new StandardInputReceiver(_simulatedIpc.RemoteStandardInputForRemote);
     _remoteDispatcher       = new MessageDispatcher(new RequestHandlers(), new RequestIdGenerator());
     LocalToRemoteConnection = new Connection(_remoteDispatcher, _remoteSender, _remoteReceiver, localToRemoteOptions);
     _localSender            = new Sender(_simulatedIpc.RemoteStandardInputForLocal);
     _localReceiver          = new StandardInputReceiver(_simulatedIpc.RemoteStandardOutputForLocal);
     _localDispatcher        = new MessageDispatcher(new RequestHandlers(), new RequestIdGenerator());
     RemoteToLocalConnection = new Connection(_localDispatcher, _localSender, _localReceiver, remoteToLocalOptions);
     CancellationToken       = _combinedCancellationTokenSource.Token;
 }
示例#3
0
            internal ConnectAsyncTest(ConnectionOptions localToRemoteOptions, ConnectionOptions remoteToLocalOptions)
            {
                Logger = new TestPluginLogger();
                var localLogger = Logger.CreateLogger("A");

                _combinedCancellationTokenSource = new CancellationTokenSource();
                _simulatedIpc           = SimulatedIpc.Create(_combinedCancellationTokenSource.Token);
                _remoteSender           = new Sender(_simulatedIpc.RemoteStandardOutputForRemote);
                _remoteReceiver         = new StandardInputReceiver(_simulatedIpc.RemoteStandardInputForRemote);
                _remoteDispatcher       = new MessageDispatcher(new RequestHandlers(), new RequestIdGenerator(), new InboundRequestProcessingHandler(Enumerable.Empty <MessageMethod>()), localLogger);
                LocalToRemoteConnection = new Connection(_remoteDispatcher, _remoteSender, _remoteReceiver, localToRemoteOptions, localLogger);

                var remoteLogger = Logger.CreateLogger("B");

                _localSender            = new Sender(_simulatedIpc.RemoteStandardInputForLocal);
                _localReceiver          = new StandardInputReceiver(_simulatedIpc.RemoteStandardOutputForLocal);
                _localDispatcher        = new MessageDispatcher(new RequestHandlers(), new RequestIdGenerator(), new InboundRequestProcessingHandler(Enumerable.Empty <MessageMethod>()), remoteLogger);
                RemoteToLocalConnection = new Connection(_localDispatcher, _localSender, _localReceiver, remoteToLocalOptions, remoteLogger);
                CancellationToken       = _combinedCancellationTokenSource.Token;
            }