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();
 }
        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");
        }
        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");
        }
 //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();
 }
Exemple #5
0
 private void setTransportFactory(TransportFactory factory)
 {
     this.factory = factory;
 }
Exemple #6
0
 public SocketFactory(WriterStorage writerStorage, TransportFactory factory)
 {
     this.writerStorage = writerStorage;
     //this.readerStorage = readerStorage;
     this.setTransportFactory(factory);
 }
Exemple #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();
        }
Exemple #8
0
 private void  setTransportFactory(TransportFactory factory)
 {
     this.factory = factory;
 }
Exemple #9
0
 public SocketFactory(WriterStorage writerStorage, TransportFactory factory)
 {
     this.writerStorage = writerStorage;
     //this.readerStorage = readerStorage;
     this.setTransportFactory(factory);
 }