#vulnerable code 
                                @Test
    public void serverToClientBackpressure() throws InterruptedException {
        Object lock = new Object();
        BackpressureDetector clientBackpressureDetector = new BackpressureDetector(madMultipleCutoff);

        ReactorNumbersGrpc.ReactorNumbersStub stub = ReactorNumbersGrpc.newReactorStub(channel);

        Mono<Empty> reactorRequest = Mono.just(Empty.getDefaultInstance());

        Flux<NumberProto.Number> reactorResponse = stub.responsePressure(reactorRequest);
        reactorResponse.subscribe(
                n -> {
                    clientBackpressureDetector.tick();
                    System.out.println(n.getNumber(0) + "  <--");
                    try { Thread.sleep(50); } catch (InterruptedException e) {}
                },
                t -> {
                    t.printStackTrace();
                    synchronized (lock) {
                        lock.notify();
                    }
                },
                () -> {
                    System.out.println("Client done.");
                    synchronized (lock) {
                        lock.notify();
                    }
                });

        synchronized (lock) {
            lock.wait(TimeUnit.SECONDS.toMillis(20));
        }

        assertThat(serverRespBPDetector.backpressureDelayOcurred()).isTrue();
    } 
                            #location 6 
                            #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code
                                @Test
    public void serverToClientBackpressure() throws InterruptedException {
        ReactorNumbersGrpc.ReactorNumbersStub stub = ReactorNumbersGrpc.newReactorStub(channel);

        Mono<Empty> reactorRequest = Mono.just(Empty.getDefaultInstance());

        Flux<NumberProto.Number> reactorResponse = stub.responsePressure(reactorRequest)
                .doOnNext(n -> System.out.println(n.getNumber(0) + "  <--"))
                .doOnNext(n -> waitIfValuesAreEqual(n.getNumber(0), 3));

        StepVerifier.create(reactorResponse)
                .expectNextCount(NUMBER_OF_STREAM_ELEMENTS)
                .expectComplete()
                .verify(Duration.ofSeconds(5));

        assertThat(numberOfWaits.get()).isEqualTo(1);
    }