()
| 42 | } |
| 43 | |
| 44 | func main() { |
| 45 | flag.Parse() |
| 46 | |
| 47 | conn, err := grpc.NewClient(*addr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithKeepaliveParams(kacp)) |
| 48 | if err != nil { |
| 49 | log.Fatalf("did not connect: %v", err) |
| 50 | } |
| 51 | defer conn.Close() |
| 52 | |
| 53 | c := pb.NewEchoClient(conn) |
| 54 | |
| 55 | ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute) |
| 56 | defer cancel() |
| 57 | fmt.Println("Performing unary request") |
| 58 | res, err := c.UnaryEcho(ctx, &pb.EchoRequest{Message: "keepalive demo"}) |
| 59 | if err != nil { |
| 60 | log.Fatalf("unexpected error from UnaryEcho: %v", err) |
| 61 | } |
| 62 | fmt.Println("RPC response:", res) |
| 63 | select {} // Block forever; run with GODEBUG=http2debug=2 to observe ping frames and GOAWAYs due to idleness. |
| 64 | } |
nothing calls this directly
no test coverage detected