예제 #1
0
        public static void Main(string[] args)
        {
            var cacert         = File.ReadAllText(@"C:\Sertifika\ca.crt");
            var servercert     = File.ReadAllText(@"C:\Sertifika\server.crt");
            var serverkey      = File.ReadAllText(@"C:\Sertifika\server.key");
            var keypair        = new KeyCertificatePair(servercert, serverkey);
            var sslCredentials = new SslServerCredentials(new List <KeyCertificatePair>()
            {
                keypair
            }, cacert, false);


            Server server = new Server
            {
                Services = { Greeter.BindService(TransparentProxy <GreeterImpl, Greeter.GreeterBase> .GenerateProxy()) },
                Ports    = { new ServerPort("localhost", Port, sslCredentials) }
            };

            server.Start();

            Console.WriteLine("Greeter server listening on port " + Port);
            Console.WriteLine("Press any key to stop the server...");
            Console.ReadKey();

            server.ShutdownAsync().Wait();
        }
예제 #2
0
        public static TI GenerateProxy()
        {
            var instance = new TransparentProxy <T, TI>();

            return((TI)instance.GetTransparentProxy());
        }