MCPcopy
hub / github.com/grpc/grpc-go / startServer

Function startServer

credentials/alts/alts_test.go:483–501  ·  view source on GitHub ↗
(t *testing.T, handshakerServiceAddress string)

Source from the content-addressed store, hash-verified

481}
482
483func startServer(t *testing.T, handshakerServiceAddress string) (stop func(), address string) {
484 listener, err := testutils.LocalTCPListener()
485 if err != nil {
486 t.Fatalf("LocalTCPListener() failed: %v", err)
487 }
488 serverOpts := &ServerOptions{HandshakerServiceAddress: handshakerServiceAddress}
489 creds := NewServerCreds(serverOpts)
490 stub := &stubserver.StubServer{
491 Listener: listener,
492 UnaryCallF: func(context.Context, *testpb.SimpleRequest) (*testpb.SimpleResponse, error) {
493 return &testpb.SimpleResponse{
494 Payload: &testpb.Payload{},
495 }, nil
496 },
497 S: grpc.NewServer(grpc.Creds(creds)),
498 }
499 stubserver.StartTestService(t, stub)
500 return func() { stub.S.Stop() }, listener.Addr().String()
501}

Callers 3

TestFullHandshakeMethod · 0.70

Calls 9

LocalTCPListenerFunction · 0.92
NewServerFunction · 0.92
CredsFunction · 0.92
StartTestServiceFunction · 0.92
NewServerCredsFunction · 0.70
FatalfMethod · 0.65
StopMethod · 0.65
StringMethod · 0.65
AddrMethod · 0.45

Tested by

no test coverage detected