@Override
  public void stopWorker(
      StopWorkerRequest request, StreamObserver<StopWorkerResponse> responseObserver) {
    // Thread based workers terminate automatically
    responseObserver.onNext(StopWorkerResponse.newBuilder().build());
    responseObserver.onCompleted();
  }
@Test
  public void stopWorker() {
    PipelineOptions options = PipelineOptionsFactory.create();
    StopWorkerRequest request = StopWorkerRequest.getDefaultInstance();
    StreamObserver<StopWorkerResponse> responseObserver = mock(StreamObserver.class);
    ExternalWorkerService service = new ExternalWorkerService(options);
    service.stopWorker(request, responseObserver);

    verify(responseObserver).onNext(any(StopWorkerResponse.class));
    verify(responseObserver).onCompleted();
  }