blob: f64041a8034f7ccc83bcf7dc8bc78c1059db20a9 [file] [log] [blame]
Eric Gribkoffc344e872017-01-09 10:53:50 -08001/*
2 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +02003 * Copyright 2016 gRPC authors.
Eric Gribkoffc344e872017-01-09 10:53:50 -08004 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +02005 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
Eric Gribkoffc344e872017-01-09 10:53:50 -08008 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +02009 * http://www.apache.org/licenses/LICENSE-2.0
Eric Gribkoffc344e872017-01-09 10:53:50 -080010 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +020011 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
Eric Gribkoffc344e872017-01-09 10:53:50 -080016 *
17 */
18
19#ifndef GRPC_TEST_CPP_INTEROP_HTTP2_CLIENT_H
20#define GRPC_TEST_CPP_INTEROP_HTTP2_CLIENT_H
21
22#include <memory>
23
24#include <grpc++/channel.h>
25#include <grpc/grpc.h>
yang-gd0084c22017-03-06 11:23:35 -080026#include "src/proto/grpc/testing/messages.pb.h"
Eric Gribkoffc344e872017-01-09 10:53:50 -080027#include "src/proto/grpc/testing/test.grpc.pb.h"
28
29namespace grpc {
30namespace testing {
31
32class Http2Client {
33 public:
34 explicit Http2Client(std::shared_ptr<Channel> channel);
35 ~Http2Client() {}
36
37 bool DoRstAfterHeader();
38 bool DoRstAfterData();
39 bool DoRstDuringData();
40 bool DoGoaway();
41 bool DoPing();
42 bool DoMaxStreams();
43
44 private:
45 class ServiceStub {
46 public:
47 ServiceStub(std::shared_ptr<Channel> channel);
48
49 TestService::Stub* Get();
50
51 private:
52 std::unique_ptr<TestService::Stub> stub_;
53 std::shared_ptr<Channel> channel_;
54 };
55
56 void MaxStreamsWorker(std::shared_ptr<grpc::Channel> channel);
57 bool AssertStatusCode(const Status& s, StatusCode expected_code);
Eric Gribkoff11a4ed82017-03-01 10:33:07 -080058 Status SendUnaryCall(SimpleResponse* response);
59 SimpleRequest BuildDefaultRequest();
Eric Gribkoffc344e872017-01-09 10:53:50 -080060 ServiceStub serviceStub_;
61 std::shared_ptr<Channel> channel_;
Eric Gribkoff11a4ed82017-03-01 10:33:07 -080062 SimpleRequest defaultRequest_;
Eric Gribkoffc344e872017-01-09 10:53:50 -080063};
64
65} // namespace testing
66} // namespace grpc
67
68#endif // GRPC_TEST_CPP_INTEROP_HTTP2_CLIENT_H