Пример #1
0
 public ConnectorFactory(WriterStorage writerStorage, TransportFactory factory) : base(writerStorage, factory)
 {
     connector            = new Connector(connectorStorage);
     connectorThread      = new Thread(new System.Threading.ThreadStart(connector.Run));
     connectorThread.Name = "BNMQ-Connector";
     connectorThread.Start();
 }
Пример #2
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");
        }
Пример #3
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");
        }
Пример #4
0
 //protected internal AcceptorStorage acceptorStorage = new AcceptorStorage();
 //protected internal System.Threading.Thread acceptorThread = null;
 //protected internal Acceptor acceptorThreadBody;
 //protected IDictionary<String, ServerTransport> storage = new Dictionary<String, ServerTransport>();
 public AcceptorFactory(WriterStorage writerStorage, TransportFactory factory)
     : base(writerStorage, factory)
 {
     //initAcceptors();
 }
Пример #5
0
 private void setTransportFactory(TransportFactory factory)
 {
     this.factory = factory;
 }
Пример #6
0
 public SocketFactory(WriterStorage writerStorage, TransportFactory factory)
 {
     this.writerStorage = writerStorage;
     //this.readerStorage = readerStorage;
     this.setTransportFactory(factory);
 }
Пример #7
0
        //protected internal AcceptorStorage acceptorStorage = new AcceptorStorage();
        //protected internal System.Threading.Thread acceptorThread = null;
        //protected internal Acceptor acceptorThreadBody;
        //protected IDictionary<String, ServerTransport> storage = new Dictionary<String, ServerTransport>();

        public AcceptorFactory(WriterStorage writerStorage, TransportFactory factory) : base(writerStorage, factory)
        {
            //initAcceptors();
        }
Пример #8
0
 private void  setTransportFactory(TransportFactory factory)
 {
     this.factory = factory;
 }
Пример #9
0
 public SocketFactory(WriterStorage writerStorage, TransportFactory factory)
 {
     this.writerStorage = writerStorage;
     //this.readerStorage = readerStorage;
     this.setTransportFactory(factory);
 }