@Test public void fileByFilenameConsistentForMutableServices() throws Exception { ServerReflectionRequest request = ServerReflectionRequest.newBuilder() .setHost(TEST_HOST) .setFileByFilename("io/grpc/reflection/testing/dynamic_reflection_test_depth_two.proto") .build(); ServerReflectionResponse goldenResponse = ServerReflectionResponse.newBuilder() .setValidHost(TEST_HOST) .setOriginalRequest(request) .setFileDescriptorResponse( FileDescriptorResponse.newBuilder() .addFileDescriptorProto( DynamicReflectionTestDepthTwoProto.getDescriptor().toProto().toByteString()) .build()) .build(); StreamRecorder<ServerReflectionResponse> responseObserver = StreamRecorder.create(); StreamObserver<ServerReflectionRequest> requestObserver = stub.serverReflectionInfo(responseObserver); handlerRegistry.addService(dynamicService); requestObserver.onNext(request); requestObserver.onCompleted(); StreamRecorder<ServerReflectionResponse> responseObserver2 = StreamRecorder.create(); StreamObserver<ServerReflectionRequest> requestObserver2 = stub.serverReflectionInfo(responseObserver2); handlerRegistry.removeService(dynamicService); requestObserver2.onNext(request); requestObserver2.onCompleted(); StreamRecorder<ServerReflectionResponse> responseObserver3 = StreamRecorder.create(); StreamObserver<ServerReflectionRequest> requestObserver3 = stub.serverReflectionInfo(responseObserver3); requestObserver3.onNext(request); requestObserver3.onCompleted(); assertEquals( ServerReflectionResponse.MessageResponseCase.ERROR_RESPONSE, responseObserver.firstValue().get().getMessageResponseCase()); assertEquals(goldenResponse, responseObserver2.firstValue().get()); assertEquals( ServerReflectionResponse.MessageResponseCase.ERROR_RESPONSE, responseObserver3.firstValue().get().getMessageResponseCase()); }
@Override public StreamObserver<ServerReflectionRequest> serverReflectionInfo( final StreamObserver<ServerReflectionResponse> responseObserver) { final ServerCallStreamObserver<ServerReflectionResponse> serverCallStreamObserver = (ServerCallStreamObserver<ServerReflectionResponse>) responseObserver; ProtoReflectionStreamObserver requestObserver = new ProtoReflectionStreamObserver(updateIndexIfNecessary(), serverCallStreamObserver); serverCallStreamObserver.setOnReadyHandler(requestObserver); serverCallStreamObserver.disableAutoInboundFlowControl(); serverCallStreamObserver.request(1); return requestObserver; }
ProtoReflectionService extends ServerReflectionGrpc.ServerReflectionImplBase implements InternalNotifyOnServerBuild { @Override public StreamObserver<ServerReflectionRequest> serverReflectionInfo( final StreamObserver<ServerReflectionResponse> responseObserver) { final ServerCallStreamObserver<ServerReflectionResponse> serverCallStreamObserver = (ServerCallStreamObserver<ServerReflectionResponse>) responseObserver; ProtoReflectionStreamObserver requestObserver = new ProtoReflectionStreamObserver(updateIndexIfNecessary(), serverCallStreamObserver); serverCallStreamObserver.setOnReadyHandler(requestObserver); serverCallStreamObserver.disableAutoInboundFlowControl(); serverCallStreamObserver.request(1); return requestObserver; } }
ProtoReflectionService extends ServerReflectionGrpc.ServerReflectionImplBase implements InternalNotifyOnServerBuild { @Override public StreamObserver<ServerReflectionRequest> serverReflectionInfo( final StreamObserver<ServerReflectionResponse> responseObserver) { final ServerCallStreamObserver<ServerReflectionResponse> serverCallStreamObserver = (ServerCallStreamObserver<ServerReflectionResponse>) responseObserver; ProtoReflectionStreamObserver requestObserver = new ProtoReflectionStreamObserver(updateIndexIfNecessary(), serverCallStreamObserver); serverCallStreamObserver.setOnReadyHandler(requestObserver); serverCallStreamObserver.disableAutoInboundFlowControl(); serverCallStreamObserver.request(1); return requestObserver; } private  ProtoReflectionService(); }
ProtoReflectionService extends ServerReflectionGrpc.ServerReflectionImplBase implements InternalNotifyOnServerBuild { @Override public StreamObserver<ServerReflectionRequest> serverReflectionInfo( final StreamObserver<ServerReflectionResponse> responseObserver) { final ServerCallStreamObserver<ServerReflectionResponse> serverCallStreamObserver = (ServerCallStreamObserver<ServerReflectionResponse>) responseObserver; ProtoReflectionStreamObserver requestObserver = new ProtoReflectionStreamObserver(updateIndexIfNecessary(), serverCallStreamObserver); serverCallStreamObserver.setOnReadyHandler(requestObserver); serverCallStreamObserver.disableAutoInboundFlowControl(); serverCallStreamObserver.request(1); return requestObserver; } private  ProtoReflectionService(); static BindableService newInstance(); @Override void notifyOnBuild(Server server); @Override StreamObserver<ServerReflectionRequest> serverReflectionInfo(
      final StreamObserver<ServerReflectionResponse> responseObserver); }
ProtoReflectionService extends ServerReflectionGrpc.ServerReflectionImplBase implements InternalNotifyOnServerBuild { @Override public StreamObserver<ServerReflectionRequest> serverReflectionInfo( final StreamObserver<ServerReflectionResponse> responseObserver) { final ServerCallStreamObserver<ServerReflectionResponse> serverCallStreamObserver = (ServerCallStreamObserver<ServerReflectionResponse>) responseObserver; ProtoReflectionStreamObserver requestObserver = new ProtoReflectionStreamObserver(updateIndexIfNecessary(), serverCallStreamObserver); serverCallStreamObserver.setOnReadyHandler(requestObserver); serverCallStreamObserver.disableAutoInboundFlowControl(); serverCallStreamObserver.request(1); return requestObserver; } private  ProtoReflectionService(); static BindableService newInstance(); @Override void notifyOnBuild(Server server); @Override StreamObserver<ServerReflectionRequest> serverReflectionInfo(
      final StreamObserver<ServerReflectionResponse> responseObserver);  }