diff --git a/src/android/test/interop/app/src/main/cpp/grpc-interop.cc b/src/android/test/interop/app/src/main/cpp/grpc-interop.cc index 40009dd0223..efa6e9ebb2d 100644 --- a/src/android/test/interop/app/src/main/cpp/grpc-interop.cc +++ b/src/android/test/interop/app/src/main/cpp/grpc-interop.cc @@ -16,30 +16,30 @@ * */ -#include #include +#include "absl/strings/str_format.h" + +#include + #include "src/core/lib/security/security_connector/ssl_utils_config.h" #include "test/cpp/interop/interop_client.h" std::shared_ptr GetClient(const char* host, int port, bool use_tls) { - const int host_port_buf_size = 1024; - char host_port[host_port_buf_size]; - snprintf(host_port, host_port_buf_size, "%s:%d", host, port); - std::shared_ptr credentials; if (use_tls) { credentials = grpc::SslCredentials(grpc::SslCredentialsOptions()); } else { credentials = grpc::InsecureChannelCredentials(); } - - grpc::testing::ChannelCreationFunc channel_creation_func = - std::bind(grpc::CreateChannel, host_port, credentials); - return std::shared_ptr( - new grpc::testing::InteropClient(channel_creation_func, true, false)); + std::string host_port = absl::StrFormat("%s:%d", host, port); + return std::make_shared( + [host_port, credentials](grpc::ChannelArguments args) { + return grpc::CreateCustomChannel(host_port, credentials, args); + }, + true, false); } extern "C" JNIEXPORT jboolean JNICALL