Ejemplo n.º 1
0
        public IWampClientProxy <TMessage> Create(IMessagePlayer <TMessage> player,
                                                  IMessageRecorder <TMessage> recorder,
                                                  WampMessage <TMessage> welcomeMessage)
        {
            ProxyGenerationOptions options =
                new ProxyGenerationOptions();

            options.Selector = new MockClientInterceptorSelector();

            IWampFormatter <TMessage> formatter = mBinding.Formatter;

            long           sessionId      = formatter.Deserialize <long>(welcomeMessage.Arguments[0]);
            WelcomeDetails welcomeDetails = formatter.Deserialize <WelcomeDetails>(welcomeMessage.Arguments[1]);


            IWampClientProxy <TMessage> result =
                mGenerator.CreateInterfaceProxyWithoutTarget
                    (typeof(IWampClientProxy),
                    new[]
            {
                typeof(IWampClientProxy <TMessage>),
                typeof(IWampConnectionMonitor)
            },
                    options,
                    new RecordAndPlayRawInterceptor <TMessage>(player, recorder, mBinding),
                    new RecordAndPlayInterceptor <TMessage>
                        (mOutgoingSerializer, player, recorder, mBinding),
                    new SessionPropertyInterceptor(sessionId),
                    new WelcomeDetailsInterceptor(welcomeDetails))
                as IWampClientProxy <TMessage>;

            return(result);
        }
Ejemplo n.º 2
0
 public RecordAndPlayInterceptor(IWampOutgoingRequestSerializer outgoingSerializer, IMessagePlayer <TMessage> player, IMessageRecorder <TMessage> recorder, IWampBinding <TMessage> binding)
 {
     mOutgoingSerializer = outgoingSerializer;
     mPlayer             = player;
     mRecorder           = recorder;
     mBinding            = binding;
 }
Ejemplo n.º 3
0
        public void Start()
        {
            if (_isStarted)
            {
                return;
            }
            _isStarted = true;

            var registry = Activator.CreateInstance(_registryType).As <FubuRegistry>();

            registry.NodeName = _name;
            registry.ServiceBus.EnableInMemoryTransport();
            registry.Services.ReplaceService <IEnvelopeHandler, ExternalNodeEnvelopeHandler>();
            TestNodes.Alterations.Each(x => x(registry));


            var container = new Container(x =>
            {
                x.ForSingletonOf <IMessageRecorder>().Use <MessageRecorder>();
                x.Forward <IMessageRecorder, IListener>();
            });

            registry.StructureMap(container);

            Runtime   = registry.ToRuntime();
            Uri       = Runtime.Get <ChannelGraph>().ReplyUriList().First();
            _recorder = Runtime.Get <IMessageRecorder>();

            // Wireup the messaging session so the MessageHistory gets notified of messages on this node
            _messageListener = Runtime.Get <IMessagingSession>();
            FubuMVC.Core.Services.Messaging.GlobalMessageTracking.Messaging.AddListener(_messageListener);
        }
Ejemplo n.º 4
0
        public static IMessageRecorder SetMessageRecorder(IMessageRecorder recorder)
        {
            IMessageRecorder previous = msg_recorder;

            msg_recorder = recorder;
            return(previous);
        }
Ejemplo n.º 5
0
        public GameServer()
        {
            messageHelper = new MessageHelper();
            connectionIds = new Dictionary<long, ushort>();

            entityHelper = new ServerEntityHelper();
            tempEntityEvents = new Dictionary<ushort, List<EntityEvent>>();

            tickrateTimer = new GameTimer(TimeSpan.FromMilliseconds(1000 / 20));
            timeoutTimer = new GameTimer(TimeSpan.FromSeconds(20));

            InitializePacketSizeLookup();

            Logger.RegisterLogLevelsFor<GameServer>(Logger.LogLevels.Adaptive);

            #if DEBUG
            recorder = new DefaultMessageRecorder();
            #endif
        }
 public RecordAndPlayRawInterceptor(IMessagePlayer <TMessage> player, IMessageRecorder <TMessage> recorder, IWampBinding <TMessage> binding)
 {
     mPlayer   = player;
     mRecorder = recorder;
     mBinding  = binding;
 }
Ejemplo n.º 7
0
		public static IMessageRecorder SetMessageRecorder (IMessageRecorder recorder)
		{
			IMessageRecorder previous = msg_recorder;
			msg_recorder = recorder;
			return previous;
		}
Ejemplo n.º 8
0
 public MockClient(TClient client, IMessageRecorder <MockRaw> recorder)
 {
     Client    = client;
     mRecorder = recorder;
 }