#fixed code
                                public static void main(String[] args) throws Exception {
		try (MongoClient client = new MongoClient(Connection.URI)) {
    		MongoCollection<Document> eventCollection = 
    				client.getDatabase("test").getCollection("events");
	
    		ChangeStreamIterable<Document> changes = eventCollection.watch(asList( 
    				Aggregates.match( and( asList( 
    					in("operationType", asList("insert")),
    					eq("fullDocument.even", 1L)))
    	    )));
    		
    		changes.iterator().forEachRemaining(
    				change -> System.out.println("received: " + change.getFullDocument())
    		);
		}
    }
#vulnerable code 
                                public static void main(String[] args) throws Exception {
    	
    		MongoCollection<Document> eventCollection = 
    				new MongoClient(
    						new MongoClientURI("mongodb://localhost:27001,localhost:27002,localhost:27003/test?replicatSet=demo-dev")
    				).getDatabase("test").getCollection("events");
	
    		ChangeStreamIterable<Document> changes = eventCollection.watch(asList( 
    				Aggregates.match( and( asList( 
    					in("operationType", asList("insert")),
    					eq("fullDocument.even", 1L)))
    	    )));
    		
    		changes.forEach(new Block<ChangeStreamDocument<Document>>() {
				@Override
				public void apply(ChangeStreamDocument<Document> t) {
					System.out.println("received: " + t.getFullDocument());
				}
    		});
    } 
                            #location 6 
                            #vulnerability type RESOURCE_LEAK