示例#1
0
        public IntegrationBase()
        {
            server = new MockTCP(wire);
            client = new MockTCP(wire);

            server.other = client;
            client.other = server;

            serverStatefulSession  = FTConnectionController.CreateStatefulSession(server, new StateProvider(), 5000, 8000);
            clientStatelessSession = FTConnectionController.CreateStatelessSession(client, 5000, 8000);

            serverTree.AttachErrorHandler();
            clientTree.AttachErrorHandler();

            serverSerializer = new DataSerializer();
            clientSerializer = new DataSerializer();
            serverSerializer.AttachErrorHandler();
            clientSerializer.AttachErrorHandler();

            serverTree.ConnectToDownstream(serverSerializer);
            serverSerializer.ConnectToDownstream(server);
            server.ConnectToUpstream(serverSerializer);
            serverSerializer.ConnectToUpstream(serverTree);

            clientTree.ConnectToDownstream(clientSerializer);
            clientSerializer.ConnectToDownstream(client);
            client.ConnectToUpstream(clientSerializer);
            clientSerializer.ConnectToUpstream(clientTree);

            serverData     = new LeafProtocolHandler <MockData1>();
            clientData     = new LeafProtocolHandler <MockData1>();
            clientRecovery = new LeafProtocolHandler <MockData2>();

            serverTree.Register(serverStatefulSession);
            serverTree.Register(serverData);
            serverTree.Entry(serverStatefulSession);
            serverTree.ConnectToLeaf(serverStatefulSession, serverData);

            clientTree.Register(clientStatelessSession);
            clientTree.Register(clientData);
            clientTree.Register(clientRecovery);
            clientTree.Entry(clientStatelessSession);
            clientTree.ConnectToLeaf(clientStatelessSession, clientData);
            clientTree.ConnectToLeaf(clientStatelessSession, clientRecovery);

            serverData.NewData     += protocol => { protocol.Verify(); serverDataCount++; };
            clientData.NewData     += protocol => { protocol.Verify(); clientDataCount++; };
            clientRecovery.NewData += protocol => { protocol.Verify(); recoveryCount++; };
        }
示例#2
0
        private ApplicationConnectionManager(ITransportationLayer transportationLayer)
        {
            this.transportationLayer = transportationLayer;

            tree.DataIntegrityError    += OnDataIntegrityError;
            tree.DataSymmetricityError += OnDataSymmetricityError;

            dataSerializer.DataIntegrityError    += OnDataIntegrityError;
            dataSerializer.DataSymmetricityError += OnDataSymmetricityError;

            transportationLayer.ConnectToUpstream(dataSerializer);
            dataSerializer.ConnectToDownstream(transportationLayer);

            dataSerializer.ConnectToUpstream(tree);
            tree.ConnectToDownstream(dataSerializer);
        }