GetClientConnection() 공개 메소드

public GetClientConnection ( ) : IClientConnection
리턴 IClientConnection
예제 #1
0
        public void SetUp()
        {
            this.queue = new ReliableQueue();

            var provider = new MockConnectionProvider(MockProtocol.Instance);

            this.connection = provider.GetClientConnection();
        }
예제 #2
0
        public void MessageHandling()
        {
            IServerConnection connection = null;

            var test = new AsyncTest(e =>
            {
                var me = (MessageEventArgs)e;
                Assert.AreSame(connection, me.Connection);
                Assert.IsTrue(me.Message is MockMessage);
                Assert.AreEqual("hi", ((MockMessage)me.Message).Content);
            });

            var server = new TempestServer(provider, MessageTypes.Reliable);

            server.Start();

            Action <MessageEventArgs> handler = e => test.PassHandler(test, e);

            ((IContext)server).RegisterMessageHandler(MockProtocol.Instance, 1, handler);

            provider.ConnectionMade += (sender, e) => connection = e.Connection;

            var c = provider.GetClientConnection(protocol);

            c.ConnectAsync(new Target(Target.AnyIP, 0), MessageTypes.Reliable);
            c.SendAsync(new MockMessage()
            {
                Content = "hi"
            });

            test.Assert(10000);
        }
예제 #3
0
        public void ServerConnectionConnected()
        {
            var provider = new MockConnectionProvider (MockProtocol.Instance);
            provider.Start (MessageTypes.Reliable);

            var test = new AsyncTest<ConnectionMadeEventArgs> (e => Assert.AreEqual (true, e.Connection.IsConnected));
            provider.ConnectionMade += test.PassHandler;

            var client = provider.GetClientConnection (MockProtocol.Instance);
            client.ConnectAsync (new Target (Target.AnyIP, 0), MessageTypes.Reliable);

            test.Assert (5000);
        }
예제 #4
0
        public void ServerConnectionConnected()
        {
            var provider = new MockConnectionProvider(MockProtocol.Instance);

            provider.Start(MessageTypes.Reliable);

            var test = new AsyncTest <ConnectionMadeEventArgs> (e => Assert.AreEqual(true, e.Connection.IsConnected));

            provider.ConnectionMade += test.PassHandler;

            var client = provider.GetClientConnection(MockProtocol.Instance);

            client.ConnectAsync(new Target(Target.AnyIP, 0), MessageTypes.Reliable);

            test.Assert(5000);
        }
예제 #5
0
        public void SetUp()
        {
            this.queue = new ReliableQueue();

            var provider = new MockConnectionProvider (MockProtocol.Instance);
            this.connection = provider.GetClientConnection();
        }