Пример #1
0
        public static IRpcServer Bind(Uri uri, IChannelHandler[] handlers)
        {
            Contract.Requires(handlers != null && handlers.Any());

            IChannelHandler handler;
            if (handlers.Count() == 1)
            {
                handler = handlers[0];
            }
            else
            {
                handler = new ChannelHandlerDispatcher(handlers);
            }

            var transporter = GetTransporter();
            return transporter.Bind(uri, handler);
        }
Пример #2
0
        private static IRpcClient Connect(Uri uri, IChannelHandler[] handlers)
        {
            IChannelHandler handler;
            if (!handlers.Any())
            {
                handler = new ChannelHandlerAdapter();
            }
            else if (handlers.Count() == 1)
            {
                handler = handlers[0];
            }
            else
            {
                handler = new ChannelHandlerDispatcher(handlers);
            }

            var transporter = GetTransporter();
            return transporter.Connect(uri, handler);
        }