#vulnerable code 
                                public void run() throws Exception {
        TChannel tchannel = new TChannel.Builder("ping-client").build();

        Req<Ping> req = new Req<Ping>(
                "ping",
                new HashMap<String, String>() {
                    {
                        put("some", "header");
                    }
                },
                new Ping("{'key': 'ping?'}")
        );

        for (int i = 0; i < this.requests; i++) {
            Promise<Res<Pong>> f = tchannel.makeRequest(
                    this.host,
                    this.port,
                    "service",
                    ArgScheme.JSON.getScheme(),
                    Pong.class,
                    req
            );

            f.addListener(new GenericFutureListener<Future<? super Res<Pong>>>() {
                @Override
                public void operationComplete(Future<? super Res<Pong>> future) throws Exception {
                    if (future.isSuccess()) {
                        Res<Pong> res = (Res<Pong>) future.get();
                        System.out.println(res);
                    }
                }
            });

        }

        tchannel.shutdown();

    } 
                            #location 36 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                public void run() throws Exception {
        TChannel tchannel = new TChannel.Builder("ping-client").build();

        Map<String, String> headers = new HashMap<String, String>() {
            {
                put("some", "header");
            }
        };

        Request<Ping> request = new Request.Builder<>(new Ping("{'key': 'ping?'}"))
                .setEndpoint("ping")
                .setHeaders(headers)
                .build();

        for (int i = 0; i < this.requests; i++) {
            Promise<Response<Pong>> f = tchannel.makeRequest(
                    this.host,
                    this.port,
                    "service",
                    ArgScheme.JSON,
                    request,
                    Pong.class
            );

            final int iteration = i;
            f.addListener(new GenericFutureListener<Future<? super Response<Pong>>>() {
                @Override
                public void operationComplete(Future<? super Response<Pong>> future) throws Exception {
                    Response<?> response = (Response<?>) future.get(100, TimeUnit.MILLISECONDS);
                    if (iteration % 1000 == 0) {
                        System.out.println(response);
                    }
                }

            });

        }

        tchannel.shutdown();

    }