예제 #1
0
        private static void Main(string[] args)
        {
            LogManager.Assign(new SimpleLogManager<ConsoleLogger>());

            var factory = new DelegatePipelineFactory();
            //CreateSimplePipeline(factory);
            CreateRpcPipeline(factory);

            var server = new PipelineServer(factory, new ServerConfiguration());
            server.Start(new IPEndPoint(IPAddress.Any, 3322));

            Console.ReadLine();
        }
예제 #2
0
        public static void RunDemo()
        {
            var authService = new DummyAuthenticatorService();
            var authHandler =
                new AuthenticationHandler(
                    new DigestAuthenticator(new SingleRealmRepository("*****@*****.**"), authService), authService);

            var factory = new DelegatePipelineFactory();
            factory.AddDownstreamHandler(authHandler);
            factory.AddDownstreamHandler(() => new ResponseEncoder());

            factory.AddUpstreamHandler(() => new HeaderDecoder());
            factory.AddUpstreamHandler(new HttpErrorHandler(new SimpleErrorFormatter()));
            factory.AddUpstreamHandler(authHandler);
            factory.AddUpstreamHandler(() => new BodyDecoder(new CompositeBodyDecoder(), 65535, 6000000));
            //factory.AddUpstreamHandler(() => new FileHandler());
            factory.AddUpstreamHandler(() => new MessageHandler());
            //factory.AddUpstreamHandler(new PipelineFailureHandler());

            var server = new PipelineServer(factory, new ServerConfiguration());
            server.Start(new IPEndPoint(IPAddress.Any, 8888));
        }