public ManagedChannelBuilder<?> forTarget(String target) { ManagedChannelBuilder<?> builder = ManagedChannelBuilder.forTarget(target); if (this.customizers != null) { this.customizers.stream() .forEach(customizer -> customizer.customize(builder)); } return builder; }
public static void main(String... args) throws IOException { ManagedChannel channel = ManagedChannelBuilder.forTarget(hostport).usePlaintext().build(); try { TransportChannelProvider channelProvider =
|| NoCredentials.getInstance().equals(options.getCredentials())) { ManagedChannel managedChannel = ManagedChannelBuilder.forTarget(options.getHost()) .usePlaintext(true) .executor(executor)
private static void prepareKmsKeys() throws IOException { String projectId = remoteStorageHelper.getOptions().getProjectId(); GoogleCredentials credentials = GoogleCredentials.getApplicationDefault(); ManagedChannel kmsChannel = ManagedChannelBuilder.forTarget("cloudkms.googleapis.com:443").build(); KeyManagementServiceBlockingStub kmsStub = KeyManagementServiceGrpc.newBlockingStub(kmsChannel) .withCallCredentials(MoreCallCredentials.from(credentials)); IAMPolicyGrpc.IAMPolicyBlockingStub iamStub = IAMPolicyGrpc.newBlockingStub(kmsChannel) .withCallCredentials(MoreCallCredentials.from(credentials)); ensureKmsKeyRingExistsForTests(kmsStub, projectId, KMS_KEY_RING_LOCATION, KMS_KEY_RING_NAME); ensureKmsKeyRingIamPermissionsForTests( iamStub, projectId, KMS_KEY_RING_LOCATION, KMS_KEY_RING_NAME); kmsKeyOneResourcePath = ensureKmsKeyExistsForTests( kmsStub, projectId, KMS_KEY_RING_LOCATION, KMS_KEY_RING_NAME, KMS_KEY_ONE_NAME); kmsKeyTwoResourcePath = ensureKmsKeyExistsForTests( kmsStub, projectId, KMS_KEY_RING_LOCATION, KMS_KEY_RING_NAME, KMS_KEY_TWO_NAME); }
|| NoCredentials.getInstance().equals(options.getCredentials())) { ManagedChannel managedChannel = ManagedChannelBuilder.forTarget(options.getHost()) .usePlaintext(true) .executor(executor)
private ManagedChannel buildChannel(String address, Optional<SslContext> sslContext) { if (sslContext.isPresent()) { return NettyChannelBuilder.forTarget(address) .negotiationType(NegotiationType.TLS) .sslContext(sslContext.get()) .build(); } else { return ManagedChannelBuilder .forTarget(address).usePlaintext() .build(); } }
/** Construct client connecting to HelloWorld server at {@code host:port}. */ public HelloWorldClient(String address, String apiKey) { channel = ManagedChannelBuilder.forTarget(address) // Channels are secure by default (via SSL/TLS). For the example we disable TLS to avoid // needing certificates. .usePlaintext(true) .build(); Channel ch = ClientInterceptors.intercept(channel, new Interceptor(apiKey)); blockingStub = GreeterGrpc.newBlockingStub(ch); }
static BookstoreGrpc.BookstoreBlockingStub createBookstoreStub( String address, String apiKey, String authToken) { Channel channel = ManagedChannelBuilder.forTarget(address) .usePlaintext(true) .build(); channel = ClientInterceptors.intercept(channel, new Interceptor(apiKey, authToken)); return BookstoreGrpc.newBlockingStub(channel); }
public ManagedChannelBuilder<?> forTarget(String target) { ManagedChannelBuilder<?> builder = ManagedChannelBuilder.forTarget(target); if (this.customizers != null) { this.customizers.stream() .forEach(customizer -> customizer.customize(builder)); } return builder; }
public static Builder newBuilder() { ManagedChannel channel = ManagedChannelBuilder.forTarget("cloudtrace.googleapis.com").build(); Builder result = newBuilder(channel); result.shutdownChannelOnClose = true; return result; }
@Bean(destroyMethod = "shutdownNow") @ConditionalOnMissingBean(name = "stackdriverSenderChannel") public ManagedChannel stackdriverSenderChannel() { return ManagedChannelBuilder.forTarget("cloudtrace.googleapis.com") .userAgent(this.headerProvider.getUserAgent()) .build(); }
public static Builder newBuilder() { ManagedChannel channel = ManagedChannelBuilder.forTarget("cloudtrace.googleapis.com").build(); Builder result = newBuilder(channel); result.shutdownChannelOnClose = true; return result; }
public static Builder newBuilder() { ManagedChannel channel = ManagedChannelBuilder.forTarget("cloudtrace.googleapis.com").build(); Builder result = newBuilder(channel); result.shutdownChannelOnClose = true; return result; }
@Bean(destroyMethod = "shutdownNow") @ConditionalOnMissingBean ManagedChannel managedChannel(ZipkinStackdriverStorageProperties properties) { checkState(OpenSsl.isAvailable() || jettyAlpnAvailable(), "OpenSsl or ALPN is required. This usually requires either JDK9+, jetty-alpn, or netty-tcnative-boringssl-static"); return ManagedChannelBuilder.forTarget(properties.getApiHost()).build(); }
GrpcClientImpl(final String targetUrl) { this(ManagedChannelBuilder .forTarget(targetUrl.replaceFirst("^(http[s]?://www\\.|http[s]?://|www\\.)","")) .usePlaintext() .keepAliveWithoutCalls(true) .build() ); }
GrpcClientImpl(final String targetUrl) { this(ManagedChannelBuilder .forTarget(targetUrl.replaceFirst("^(http[s]?://www\\.|http[s]?://|www\\.)","")) .usePlaintext() .keepAliveWithoutCalls(true) .build() ); }
@Bean @ConditionalOnMissingBean public TransportChannelProvider transportChannelProvider(GcpPubSubProperties gcpPubSubProperties) { ManagedChannel channel = ManagedChannelBuilder .forTarget(gcpPubSubProperties.getEmulatorHost()) .usePlaintext(true) .build(); return FixedTransportChannelProvider.create(GrpcTransportChannel.create(channel)); } }
public GrpcClient(String fullnode, String soliditynode) { if (!StringUtils.isEmpty(fullnode)) { channelFull = ManagedChannelBuilder.forTarget(fullnode) .usePlaintext(true) .build(); blockingStubFull = WalletGrpc.newBlockingStub(channelFull); } if (!StringUtils.isEmpty(soliditynode)) { channelSolidity = ManagedChannelBuilder.forTarget(soliditynode) .usePlaintext(true) .build(); blockingStubSolidity = WalletSolidityGrpc.newBlockingStub(channelSolidity); blockingStubExtension = WalletExtensionGrpc.newBlockingStub(channelSolidity); } }
private ManagedChannel buildChannel(String address, Optional<SslContext> sslContext) { if (sslContext.isPresent()) { return NettyChannelBuilder.forTarget(address) .negotiationType(NegotiationType.TLS) .sslContext(sslContext.get()) .build(); } else { return ManagedChannelBuilder .forTarget(address).usePlaintext() .build(); } }
private void connect() { ManagedChannelBuilder<?> channelBuilder = ManagedChannelBuilder.forTarget(endPoint); if (useInsecure) { channelBuilder.usePlaintext(); } ManagedChannel channel = channelBuilder.build(); MetricsServiceGrpc.MetricsServiceStub stub = MetricsServiceGrpc.newStub(channel); exportRpcHandler = OcAgentMetricsServiceExportRpcHandler.create(stub); ExportMetricsServiceRequest firstRequest = ExportMetricsServiceRequest.newBuilder() .setNode(OcAgentNodeUtils.getNodeInfo(serviceName)) .setResource(OcAgentNodeUtils.getAutoDetectedResourceProto()) .build(); exportRpcHandler.onExport(firstRequest); }