Пример #1
0
        public void testSendRecvServerTransport()
        {
            const String connectionString = "bnmq://localhost:3333";
            TransportFactory conFactory = new TransportFactory();
            try {
                conFactory.TransportMessageCoderFactory = new ASN1TransportMessageCoderFactory();
                ITransport server = conFactory.getServerTransport(new Uri(connectionString));
                Assert.NotNull(server);
                server.start();
                ITransport client = conFactory.getClientTransport(new Uri(connectionString));
                Assert.NotNull(client);
                client.start();

                byte[] buffer = new byte[] { 0x01, 0x02, 0x03, 0x04 };
                for(int i=0;i<255;i++) {
                    client.sendAsync(buffer);
                }
                Thread.Sleep(500);
                server.close();
                client.close();
            }
            finally {
                conFactory.close();
            }
            Console.WriteLine("Finished: testSendRecvServerTransport");
        }
Пример #2
0
        public void testGetServerTransport()
        {
            const string connectionString = "bnmq://localhost:3333";

            TransportFactory conFactory = new TransportFactory();
            try {
                conFactory.TransportMessageCoderFactory = new ASN1TransportMessageCoderFactory();
                ITransport transport = conFactory.getServerTransport(new Uri(connectionString));
                Assert.NotNull(transport);
                transport.start();
                Thread.Sleep(500);
                transport.close();
            }
            finally {
                conFactory.close();
            }
            Console.WriteLine("Finished: testGetServerTransport");
        }