Class: SslTestService

Inherits:
Object
  • Object
show all
Includes:
GRPC::GenericService
Defined in:
src/ruby/spec/client_auth_spec.rb

Overview

a test service that checks the cert of its peer

Instance Method Summary collapse

Methods included from GRPC::GenericService

included, underscore

Instance Method Details

#a_bidi_rpc(requests, call) ⇒ Object


71
72
73
74
75
# File 'src/ruby/spec/client_auth_spec.rb', line 71

def a_bidi_rpc(requests, call)
  check_peer_cert(call)
  requests.each { |r| GRPC.logger.info(r) }
  [EchoMsg.new, EchoMsg.new]
end

#a_client_streaming_rpc(call) ⇒ Object


60
61
62
63
64
# File 'src/ruby/spec/client_auth_spec.rb', line 60

def a_client_streaming_rpc(call)
  check_peer_cert(call)
  call.each_remote_read.each { |r| GRPC.logger.info(r) }
  EchoMsg.new
end

#a_server_streaming_rpc(_, call) ⇒ Object


66
67
68
69
# File 'src/ruby/spec/client_auth_spec.rb', line 66

def a_server_streaming_rpc(_, call)
  check_peer_cert(call)
  [EchoMsg.new, EchoMsg.new]
end

#an_rpc(req, call) ⇒ Object


55
56
57
58
# File 'src/ruby/spec/client_auth_spec.rb', line 55

def an_rpc(req, call)
  check_peer_cert(call)
  req
end

#check_peer_cert(call) ⇒ Object


50
51
52
53
# File 'src/ruby/spec/client_auth_spec.rb', line 50

def check_peer_cert(call)
  error_msg = "want:\n#{client_cert}\n\ngot:\n#{call.peer_cert}"
  fail(error_msg) unless call.peer_cert == client_cert
end