Slide 25
Slide 25 text
TBNQMF
AsyncSubject subject = AsyncSubject.create();
new Thread(() -> {
Channel channel =
OkHttpChannelBuilder.forAddress(“grpc.wasabeef.jp”, 8443)
.setConnectionSpec(ConnectionSpec.MODERN_TLS)
.sslSocketFactory((SSLSocketFactory)SSLSocketFactory.getDefault())
.build();
EchoGrpc.EchoBlockingStub stub = EchoGrpc.newBlockingStub(channel);
Echo.EchoRequest req = new Echo.EchoRequest();
req.setMessage(“YES YES YES!");
Echo.EchoReply reply = stub.echo(req);
subject.onNext(reply.getMessage());
subject.onCompleted();
}).start();
subject.observeOn(AndroidSchedulers.mainThread()).subscribe(msg -> {
Log.d(“ECHO LOG” ,msg);
});