Example #1
0
        public IConnectionStub <TMessage, TKey> Build(EndPoint endpoint)
        {
            var socket = new Socket(SocketType.Stream, ProtocolType.Tcp);

            socket.Connect(endpoint);
            //var stub = new CryptoConnectionStub<TMessage, TKey>(serializer, socket, negotiator, timerService);
            var stub = new ManualCryptoConnectionStub <TMessage, TKey>(serializer, socket, negotiator, timerService);

            this.LogDebug("==> BUILDER: Begin Negotiate");
            stub.NegotiateTransportKeys();
            this.LogDebug("<== BUILDER: End Negotiate");
            return(stub);
        }
        public override IConnectionStub <TMessage, TKey> AcceptNext()
        {
            var socket = AcceptSocket();

            if (null == socket)
            {
                return(null);
            }
            //var stub = new CryptoConnectionStub<TMessage, TKey>(BinarySerializerService, socket, linkNegotiator, TimerService);
            var stub = new ManualCryptoConnectionStub <TMessage, TKey>(Serializer, socket, linkNegotiator, TimerService);

            this.LogDebug("==> LISTENER: Begin Negotiate");
            stub.NegotiateTransportKeys();
            this.LogDebug("<== LISTENER: End Negotiate");
            return(stub);
        }