	@Test
	public void testFuturePermitQueue() throws InterruptedException {

		CompletableFuture<Long> future1 = new CompletableFuture<Long>();
		svc.addToReturn(future1);
		CompletableFuture<Long> future2 = new CompletableFuture<Long>();
		svc.addToReturn(future2);
		CompletableFuture<Long> future3 = new CompletableFuture<Long>();
		svc.addToReturn(future3);
		
		queue2.runRequest(() -> svc.runFunction(1));
		queue2.runRequest(() -> svc.runFunction(2));
		queue2.runRequest(() -> svc.runFunction(3));

		List<Integer> results = svc.getAndClear();
		Assert.assertEquals(1,results.size()); 
		Assert.assertEquals(1, results.get(0).intValue());
		
		future1.complete(3L);
		
		List<Integer> results2 = svc.getAndClear();
		Assert.assertEquals(1,results2.size());
		Assert.assertEquals(2, results2.get(0).intValue());
	}