#vulnerable code 
                              @Test
  public void benchmarkPubsub() throws IOException, ExecutionException, InterruptedException {
    long start = System.currentTimeMillis();
    byte[] hello = "hello".getBytes();
    byte[] test = "test".getBytes();
    RedisClient subscriberClient = new RedisClient("localhost", 6379);
    final AtomicReference<SettableFuture> futureRef = new AtomicReference<SettableFuture>();
    subscriberClient.addListener(new MessageListener() {
      @SuppressWarnings("unchecked")
      @Override
      public void message(byte[] channel, byte[] message) {
        futureRef.get().set(null);
      }

      @SuppressWarnings("unchecked")
      @Override
      public void pmessage(byte[] pattern, byte[] channel, byte[] message) {
        futureRef.get().set(null);
      }
    });
    subscriberClient.subscribe("test");
    RedisClient publisherClient = new RedisClient("localhost", 6379);
    for (int i = 0; i < CALLS; i++) {
      SettableFuture<Object> future = SettableFuture.create();
      futureRef.set(future);
      publisherClient.publish(test, hello);
      future.get();
    }
    long end = System.currentTimeMillis();
    System.out.println("Pub/sub: " + (CALLS * 1000) / (end - start) + " calls per second");
  } 
                            #location 21 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                              @Test
  public void benchmarkPubsub() throws IOException, ExecutionException, InterruptedException {
    if (System.getenv().containsKey("CI") || System.getProperty("CI") != null) return;
    long start = System.currentTimeMillis();
    byte[] hello = "hello".getBytes();
    byte[] test = "test".getBytes();
    RedisClient subscriberClient = new RedisClient("localhost", 6379);
    final AtomicReference<SettableFuture> futureRef = new AtomicReference<SettableFuture>();
    subscriberClient.addListener(new MessageListener() {
      @SuppressWarnings("unchecked")
      @Override
      public void message(byte[] channel, byte[] message) {
        futureRef.get().set(null);
      }

      @SuppressWarnings("unchecked")
      @Override
      public void pmessage(byte[] pattern, byte[] channel, byte[] message) {
        futureRef.get().set(null);
      }
    });
    subscriberClient.subscribe("test");
    RedisClient publisherClient = new RedisClient("localhost", 6379);
    for (int i = 0; i < CALLS; i++) {
      SettableFuture<Object> future = SettableFuture.create();
      futureRef.set(future);
      publisherClient.publish(test, hello);
      future.get();
    }
    long end = System.currentTimeMillis();
    System.out.println("Pub/sub: " + (CALLS * 1000) / (end - start) + " calls per second");
  }