|
|
|
@ -16,30 +16,30 @@ |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
#include <grpcpp/grpcpp.h> |
|
|
|
|
#include <jni.h> |
|
|
|
|
|
|
|
|
|
#include "absl/strings/str_format.h" |
|
|
|
|
|
|
|
|
|
#include <grpcpp/grpcpp.h> |
|
|
|
|
|
|
|
|
|
#include "src/core/lib/security/security_connector/ssl_utils_config.h" |
|
|
|
|
#include "test/cpp/interop/interop_client.h" |
|
|
|
|
|
|
|
|
|
std::shared_ptr<grpc::testing::InteropClient> 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<grpc::ChannelCredentials> 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<grpc::testing::InteropClient>( |
|
|
|
|
new grpc::testing::InteropClient(channel_creation_func, true, false)); |
|
|
|
|
std::string host_port = absl::StrFormat("%s:%d", host, port); |
|
|
|
|
return std::make_shared<grpc::testing::InteropClient>( |
|
|
|
|
[host_port, credentials](grpc::ChannelArguments args) { |
|
|
|
|
return grpc::CreateCustomChannel(host_port, credentials, args); |
|
|
|
|
}, |
|
|
|
|
true, false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
extern "C" JNIEXPORT jboolean JNICALL |
|
|
|
|