fake_handshaker_server_main.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2018 gRPC authors.
4  *
5  * 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
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * 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.
16  *
17  */
18 #include <sstream>
19 
20 #include "absl/flags/flag.h"
21 
22 #include <grpc/support/log.h>
24 #include <grpcpp/server_builder.h>
25 
29 
30 ABSL_FLAG(int32_t, handshaker_port, 55056,
31  "TCP port on which the fake handshaker server listens to.");
32 
34  std::unique_ptr<grpc::Service> service =
36  0 /* expected max concurrent rpcs unset */);
39  builder.RegisterService(service.get());
40  gpr_log(GPR_INFO, "Fake handshaker server listening on %s",
41  server_address.c_str());
42  std::unique_ptr<grpc::Server> server = builder.BuildAndStart();
43  server->Wait();
44 }
45 
46 int main(int argc, char** argv) {
48  grpc::testing::InitTest(&argc, &argv, true);
49 
50  GPR_ASSERT(absl::GetFlag(FLAGS_handshaker_port) != 0);
51  std::ostringstream server_address;
52  server_address << "[::1]:" << absl::GetFlag(FLAGS_handshaker_port);
53 
55  return 0;
56 }
grpc::testing::InitTest
void InitTest(int *argc, char ***argv, bool remove_flags)
Definition: test_config_cc.cc:28
GPR_INFO
#define GPR_INFO
Definition: include/grpc/impl/codegen/log.h:56
grpc::gcp::CreateFakeHandshakerService
std::unique_ptr< grpc::Service > CreateFakeHandshakerService(int expected_max_concurrent_rpcs)
Definition: fake_handshaker_server.cc:283
log.h
generate.env
env
Definition: generate.py:37
service_type.h
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
fake_handshaker_server.h
main
int main(int argc, char **argv)
Definition: fake_handshaker_server_main.cc:46
server_address
std::string server_address("0.0.0.0:10000")
profile_analyzer.builder
builder
Definition: profile_analyzer.py:159
GPR_ASSERT
#define GPR_ASSERT(x)
Definition: include/grpc/impl/codegen/log.h:94
grpc::ServerBuilder
A builder class for the creation and startup of grpc::Server instances.
Definition: grpcpp/server_builder.h:86
gpr_log
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
absl::GetFlag
ABSL_MUST_USE_RESULT T GetFlag(const absl::Flag< T > &flag)
Definition: abseil-cpp/absl/flags/flag.h:98
test_config.h
server
Definition: examples/python/async_streaming/server.py:1
grpc::testing::TestEnvironment
Definition: test/core/util/test_config.h:54
ABSL_FLAG
ABSL_FLAG(int32_t, handshaker_port, 55056, "TCP port on which the fake handshaker server listens to.")
test_config.h
RunFakeHandshakerServer
static void RunFakeHandshakerServer(const std::string &server_address)
Definition: fake_handshaker_server_main.cc:33
grpc::InsecureServerCredentials
std::shared_ptr< ServerCredentials > InsecureServerCredentials()
Definition: insecure_server_credentials.cc:52
service
__attribute__((deprecated("Please use GRPCProtoMethod."))) @interface ProtoMethod NSString * service
Definition: ProtoMethod.h:25
int32_t
signed int int32_t
Definition: stdint-msvc2008.h:77
server_builder.h


grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:22