Пример #1
0
        public ConnectedState(RC4Encryptor encryptor, IMessageFactory messageFactory)
        {
            this.encryptor      = encryptor;
            this.messageFactory = messageFactory;

            this.compressor = new LZ4Compressor();
        }
Пример #2
0
        public GenericSession(Client client, IEventAggregator aggregator, IMessageFactory messageFactory, Handshake handshake)
        {
            this.client = client;
            this.client.Disconnected += this.OnDisconnected;

            this.aggregator     = aggregator;
            this.messageFactory = messageFactory;
            this.handshake      = handshake;

            logger.Trace("Session created.");

            this.handshake.HandshakeDone += delegate
            {
                this.encryptor            = new RC4Encryptor(handshake.EncryptionKey);
                this.compressor           = new LZ4Compressor();
                this.client.DataReceived += this.OnDataReceived;

                logger.Trace("Handshake done.");
            };
        }