Beispiel #1
0
 /// <summary>
 /// Setup our singleton.
 /// </summary>
 /// <param name="type"></param>
 /// <param name="arguments"></param>
 /// <returns></returns>
 /// <remarks>
 /// We want to use a singleton, but we also want to be able
 /// to let the developer to setup his own header factory.
 /// Therefore we use this method to create our own factory only if the user
 /// have not specified one.
 /// </remarks>
 private object OnSetupHeaderFactory(Type type, object[] arguments)
 {
     _headerFactory = new HeaderFactory();
     _headerFactory.AddDefaultParsers();
     _methods[typeof(HeaderFactory)] = (type2, args) => _headerFactory;
     return(_headerFactory);
 }
Beispiel #2
0
        public MessageFactoryTest()
        {
            LogFactory.Assign(new ConsoleLogFactory(null));

            _headerFactory = new HeaderFactory();
            _headerFactory.AddDefaultParsers();
            _factory = new MessageFactory(_headerFactory);
            _factory.RequestReceived  += OnRequest;
            _factory.ResponseReceived += OnResponse;
        }
Beispiel #3
0
        public SipStack()
        {
            var hf = new HeaderFactory();

            hf.AddDefaultParsers();
            _messageFactory = new MessageFactory(hf);
            _transportLayer = new TransportLayer(MessageFactory);
            _transportLayer.RequestReceived  += OnRequest;
            _transportLayer.ResponseReceived += OnResponse;
            _transactionManager = new TransactionManager(_transportLayer);
            _dialogManager      = new DialogManager(this);
            _authenticator      = new Authenticator();
        }
Beispiel #4
0
        public UdpTransportTest()
        {
            LogFactory.Assign(new ConsoleLogFactory(null));

            var headerFactory = new HeaderFactory();

            headerFactory.AddDefaultParsers();
            _messageFactory = new MessageFactory(headerFactory);
            _messageFactory.RequestReceived  += OnRequest;
            _messageFactory.ResponseReceived += OnResponse;
            var pool = new ObjectPool <byte[]>(CreateBuffer);

            _transport = new UdpTransport(new IPEndPoint(IPAddress.Loopback, PortNumber), _messageFactory)
            {
                BufferPool = _bufferPool
            };
            _transport.Start();
            _transport.UnhandledException += OnUnhandledException;
        }
Beispiel #5
0
        public TcpTransportTest(TcpTransportTestFixture fixture)
        {
            _fixture = fixture;

            ServerPort = FreeTcpPort();

            var headerFactory = new HeaderFactory();

            headerFactory.AddDefaultParsers();
            _messageFactory = new MessageFactory(headerFactory);
            _messageFactory.RequestReceived  += OnRequest;
            _messageFactory.ResponseReceived += OnResponse;
            var pool = new ObjectPool <byte[]>(CreateBuffer);

            _transport = new TcpTransport(new IPEndPoint(IPAddress.Any, ServerPort), _messageFactory)
            {
                BufferPool = _bufferPool
            };
            _transport.Start();
            _transport.UnhandledException += OnUnhandledException;
        }