Search in sources :

Example 1 with LoadReportingServiceImplBase

use of io.envoyproxy.envoy.service.load_stats.v2.LoadReportingServiceGrpc.LoadReportingServiceImplBase in project grpc-java by grpc.

the class ClientXdsClientV3Test method createLrsService.

@Override
protected BindableService createLrsService() {
    return new LoadReportingServiceImplBase() {

        @Override
        public StreamObserver<LoadStatsRequest> streamLoadStats(StreamObserver<LoadStatsResponse> responseObserver) {
            assertThat(lrsEnded.get()).isTrue();
            lrsEnded.set(false);
            @SuppressWarnings("unchecked") StreamObserver<LoadStatsRequest> requestObserver = mock(StreamObserver.class);
            LrsRpcCall call = new LrsRpcCallV3(requestObserver, responseObserver);
            Context.current().addListener(new CancellationListener() {

                @Override
                public void cancelled(Context context) {
                    lrsEnded.set(true);
                }
            }, MoreExecutors.directExecutor());
            loadReportCalls.offer(call);
            return requestObserver;
        }
    };
}
Also used : StreamObserver(io.grpc.stub.StreamObserver) Context(io.grpc.Context) UpstreamTlsContext(io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext) CertificateValidationContext(io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.CertificateValidationContext) CommonTlsContext(io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.CommonTlsContext) LoadStatsRequest(io.envoyproxy.envoy.service.load_stats.v3.LoadStatsRequest) CancellationListener(io.grpc.Context.CancellationListener) LoadReportingServiceImplBase(io.envoyproxy.envoy.service.load_stats.v3.LoadReportingServiceGrpc.LoadReportingServiceImplBase)

Example 2 with LoadReportingServiceImplBase

use of io.envoyproxy.envoy.service.load_stats.v2.LoadReportingServiceGrpc.LoadReportingServiceImplBase in project grpc-java by grpc.

the class ClientXdsClientV2Test method createLrsService.

@Override
protected BindableService createLrsService() {
    return new LoadReportingServiceImplBase() {

        @Override
        public StreamObserver<LoadStatsRequest> streamLoadStats(StreamObserver<LoadStatsResponse> responseObserver) {
            assertThat(lrsEnded.get()).isTrue();
            lrsEnded.set(false);
            @SuppressWarnings("unchecked") StreamObserver<LoadStatsRequest> requestObserver = mock(StreamObserver.class);
            LrsRpcCall call = new LrsRpcCallV2(requestObserver, responseObserver);
            Context.current().addListener(new CancellationListener() {

                @Override
                public void cancelled(Context context) {
                    lrsEnded.set(true);
                }
            }, MoreExecutors.directExecutor());
            loadReportCalls.offer(call);
            return requestObserver;
        }
    };
}
Also used : StreamObserver(io.grpc.stub.StreamObserver) Context(io.grpc.Context) CommonTlsContext(io.envoyproxy.envoy.api.v2.auth.CommonTlsContext) UpstreamTlsContext(io.envoyproxy.envoy.api.v2.auth.UpstreamTlsContext) LoadStatsRequest(io.envoyproxy.envoy.service.load_stats.v2.LoadStatsRequest) CancellationListener(io.grpc.Context.CancellationListener) LoadReportingServiceImplBase(io.envoyproxy.envoy.service.load_stats.v2.LoadReportingServiceGrpc.LoadReportingServiceImplBase)

Aggregations

Context (io.grpc.Context)2 CancellationListener (io.grpc.Context.CancellationListener)2 StreamObserver (io.grpc.stub.StreamObserver)2 CommonTlsContext (io.envoyproxy.envoy.api.v2.auth.CommonTlsContext)1 UpstreamTlsContext (io.envoyproxy.envoy.api.v2.auth.UpstreamTlsContext)1 CertificateValidationContext (io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.CertificateValidationContext)1 CommonTlsContext (io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.CommonTlsContext)1 UpstreamTlsContext (io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext)1 LoadReportingServiceImplBase (io.envoyproxy.envoy.service.load_stats.v2.LoadReportingServiceGrpc.LoadReportingServiceImplBase)1 LoadStatsRequest (io.envoyproxy.envoy.service.load_stats.v2.LoadStatsRequest)1 LoadReportingServiceImplBase (io.envoyproxy.envoy.service.load_stats.v3.LoadReportingServiceGrpc.LoadReportingServiceImplBase)1 LoadStatsRequest (io.envoyproxy.envoy.service.load_stats.v3.LoadStatsRequest)1