예제 #1
0
파일: NetTests.cs 프로젝트: rmueller/kayak
        public void SetUp()
        {
            ep = new IPEndPoint(IPAddress.Loopback, Config.Port);

            wh = new ManualResetEventSlim();

            schedulerDelegate = new SchedulerDelegate();
            scheduler         = new DefaultKayakScheduler(schedulerDelegate);

            schedulerDelegate.OnStoppedAction = () =>
            {
                stopListening.Dispose();
                stopListening = null;
                wh.Set();
            };
            schedulerDelegate.OnExceptionAction = e =>
            {
                schedulerError = e;
                Debug.WriteLine("Error on scheduler");
                e.DebugStackTrace();
                scheduler.Stop();
            };

            scheduler.Post(() =>
            {
                stopListening = server.Listen(ep);
                schedulerStartedAction();
            });

            serverDelegate = new ServerDelegate();
            server         = new DefaultKayakServer(serverDelegate, scheduler);

            clientSocketDelegate = new SocketDelegate();
            client = new DefaultKayakSocket(clientSocketDelegate, scheduler);
        }
예제 #2
0
        public void SetUp()
        {
            wh = new ManualResetEventSlim();

            schedulerDelegate = new SchedulerDelegate();
            schedulerDelegate.OnStoppedAction = () => wh.Set();
            scheduler = new DefaultKayakScheduler(schedulerDelegate);
        }
예제 #3
0
        public void SetUp()
        {
            wh = new ManualResetEventSlim();
            var schedulerDelegate = new SchedulerDelegate();
            schedulerDelegate.OnStoppedAction = () => wh.Set();
            var scheduler = new KayakScheduler(schedulerDelegate);

            var serverDelegate = new ServerDelegate();
            server = KayakServer.Factory.Create(serverDelegate, scheduler);
        }
예제 #4
0
        public void SetUp()
        {
            wh = new ManualResetEventSlim();
            var schedulerDelegate = new SchedulerDelegate();
            schedulerDelegate.OnStoppedAction = () => wh.Set();
            var scheduler = new DefaultKayakScheduler(schedulerDelegate);
            schedulerDelegate.OnExceptionAction = e =>
            {
                Debug.WriteLine("Error on scheduler");
                e.DebugStackTrace();
                scheduler.Stop();
            };

            var serverDelegate = new ServerDelegate();
            server = new DefaultKayakServer(serverDelegate, scheduler);
        }
예제 #5
0
        public void SetUp()
        {
            wh = new ManualResetEventSlim();
            var schedulerDelegate = new SchedulerDelegate();

            schedulerDelegate.OnStoppedAction = () => wh.Set();
            var scheduler = new DefaultKayakScheduler(schedulerDelegate);

            schedulerDelegate.OnExceptionAction = e =>
            {
                Debug.WriteLine("Error on scheduler");
                e.DebugStackTrace();
                scheduler.Stop();
            };

            var serverDelegate = new ServerDelegate();

            server = new DefaultKayakServer(serverDelegate, scheduler);
        }
예제 #6
0
        public void SetUp()
        {
            ep = new IPEndPoint(IPAddress.Loopback, Config.Port);

            wh = new ManualResetEventSlim();

            schedulerDelegate = new SchedulerDelegate();
            scheduler = new DefaultKayakScheduler(schedulerDelegate);

            schedulerDelegate.OnStoppedAction = () =>
            {
                stopListening.Dispose();
                stopListening = null;
                wh.Set();
            };
            schedulerDelegate.OnExceptionAction = e =>
            {
                schedulerError = e;
                Debug.WriteLine("Error on scheduler");
                e.DebugStackTrace();
                scheduler.Stop();
            };

            scheduler.Post(() =>
            {
                stopListening = server.Listen(ep);
                schedulerStartedAction();
            });

            serverDelegate = new ServerDelegate();
            server = new DefaultKayakServer(serverDelegate, scheduler);

            clientSocketDelegate = new SocketDelegate();
            client = new DefaultKayakSocket(clientSocketDelegate, scheduler);
        }
예제 #7
0
        public void SetUp()
        {
            wh = new ManualResetEventSlim();

            schedulerDelegate = new SchedulerDelegate();
            schedulerDelegate.OnStoppedAction = () => wh.Set();
            scheduler = new KayakScheduler(schedulerDelegate);
        }
예제 #8
0
        public void SetUp()
        {
            ep = new IPEndPoint(IPAddress.Loopback, Config.Port);

            wh = new ManualResetEventSlim();

            IDisposable d = null;

            var schedulerDelegate = new SchedulerDelegate();
            schedulerDelegate.OnStoppedAction = () =>
            {
                d.Dispose();
                wh.Set();
            };

            scheduler = new KayakScheduler(schedulerDelegate);
            scheduler.Post(() =>
            {
                d = server.Listen(ep);
                schedulerStartedAction();
            });

            var serverDelegate = new ServerDelegate();
            server = new KayakServer(serverDelegate, scheduler);

            clientSocketDelegate = new SocketDelegate();
            client = new KayakSocket(clientSocketDelegate, scheduler);
        }