/** {@inheritDoc} */ @Override public AltsServerBuilder intercept(ServerInterceptor interceptor) { delegate.intercept(interceptor); return this; }
/** {@inheritDoc} */ @Override public Server build() { if (!CheckGcpEnvironment.isOnGcp()) { if (enableUntrustedAlts) { logger.log( Level.WARNING, "Untrusted ALTS mode is enabled and we cannot guarantee the trustworthiness of the " + "ALTS handshaker service"); } else { Status status = Status.INTERNAL.withDescription("ALTS is only allowed to run on Google Cloud Platform"); delegate.intercept(new FailingServerInterceptor(status)); } } delegate.protocolNegotiator( AltsProtocolNegotiator.createServerNegotiator( new TsiHandshakerFactory() { @Override public TsiHandshaker newHandshaker(String authority) { // Used the shared grpc channel to connecting to the ALTS handshaker service. // TODO: Release the channel if it is not used. // https://github.com/grpc/grpc-java/issues/4755. return AltsTsiHandshaker.newServer( HandshakerServiceGrpc.newStub(handshakerChannelPool.getObject()), new AltsHandshakerOptions(RpcProtocolVersionsUtil.getRpcProtocolVersions())); } })); return delegate.build(); }