示例#1
0
        static void Main(string[] args)
        {
            var certificate = new X509Certificate2("GriffinNetworkingTemp.pfx", "mamma");

            var config = new LiteServerConfiguration();

            config.Modules.AddAuthentication(new HashAuthenticationModule(new FakeFetcher()));
            config.Modules.AddAuthorization(new MustAlwaysAuthenticate());
            var server = new LiteServer(config);

            server.Start(IPAddress.Loopback, 0);

            var client = new CqsClient(() => new DataContractMessageSerializer());

            client.Authenticator = new HashClientAuthenticator(new NetworkCredential("jonas", "mamma"));
            client.StartAsync(IPAddress.Loopback, server.LocalPort).Wait();
            client.ExecuteAsync(new HelloWorld()).Wait();


            var listener = new HttpListener();

            listener.ChannelFactory   = new SecureTcpChannelFactory(new ServerSideSslStreamBuilder(certificate));
            listener.ClientConnected += OnConnect;
            listener.MessageReceived  = OnMessage;
            listener.BodyDecoder      = new CompositeIMessageSerializer();
            listener.Start(IPAddress.Any, 8083);


            Console.ReadLine();
        }
示例#2
0
 public void Start()
 {
     _server.Start(IPAddress.Any, 0);
 }