-
-
Notifications
You must be signed in to change notification settings - Fork 295
Expand file tree
/
Copy pathProgram.cs
More file actions
27 lines (23 loc) · 908 Bytes
/
Program.cs
File metadata and controls
27 lines (23 loc) · 908 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using System;
using System.Net.Http;
using System.Security.Cryptography.X509Certificates;
using Grpc.Net.Client;
using Proto;
using Proto.Remote;
using Proto.Remote.GrpcNet;
using static Proto.Remote.RemoteConfig;
using Common;
var certificate = new X509Certificate2("../localhost.pfx", "password");
var handler = new HttpClientHandler();
handler.ServerCertificateCustomValidationCallback = (request, cert, chain, errors) =>
cert != null && cert.Thumbprint == certificate.Thumbprint;
var remoteConfig = BindToLocalhost() with
{
UseHttps = true,
ChannelOptions = new GrpcChannelOptions { HttpHandler = handler }
};
var system = new ActorSystem().WithRemote(remoteConfig);
await system.Remote().StartAsync();
var pid = PID.FromAddress("127.0.0.1:8000", "greeter");
var response = await system.Root.RequestAsync<HelloResponse>(pid, new HelloRequest("TLS"));
Console.WriteLine(response.Message);