use of io.grpc.ManagedChannelBuilder in project pinpoint by naver.
the class BuilderUtils method getUsePlainText.
private static Call getUsePlainText() {
final Class<ManagedChannelBuilder> builderClass = ManagedChannelBuilder.class;
final Method oldUsePlaintext = getMethod(builderClass, "usePlaintext");
if (oldUsePlaintext != null) {
return new Call<ManagedChannelBuilder<?>>() {
@Override
public void call(ManagedChannelBuilder<?> target) {
try {
oldUsePlaintext.invoke(target);
} catch (Exception e) {
throw new RuntimeException(e.getMessage(), e);
}
}
};
}
final Method newUsePlaintext = getMethod(builderClass, "usePlaintext", boolean.class);
if (newUsePlaintext != null) {
return new Call<ManagedChannelBuilder<?>>() {
@Override
public void call(ManagedChannelBuilder<?> target) {
try {
newUsePlaintext.invoke(target, true);
} catch (Exception e) {
throw new RuntimeException(e.getMessage(), e);
}
}
};
}
throw new UnsupportedOperationException("usePlaintext method not found");
}
use of io.grpc.ManagedChannelBuilder in project pinpoint by naver.
the class BuilderUtilsTest method usePlainText.
@Test
public void usePlainText() {
ManagedChannelBuilder mock = mock(ManagedChannelBuilder.class);
BuilderUtils.usePlainText(mock);
}
Aggregations