@Test
public void testSimple() {

    final ExecutorService exec = Executors.newCachedThreadPool();
    
    try {
        Observable<Integer> source = Observable.from(1, 2, 3)
                .subscribeOn(Schedulers.threadPoolForComputation());
        
        final AtomicInteger sum = new AtomicInteger();
        Action1<Integer> add = new Action1<Integer>() {
            @Override
            public void call(Integer t1) {
                sum.addAndGet(t1);
            }
        };
        
        FutureTask<Void> task = Async.forEachFuture(source, add);
        
        exec.execute(task);
        
        try {
            Void value = task.get(1000, TimeUnit.MILLISECONDS);
            
            assertEquals(null, value);
            
            assertEquals(6, sum.get());
        } catch (TimeoutException ex) {
            fail("Timed out: " + ex);
        } catch (ExecutionException ex) {
            fail("Exception: " + ex);
        } catch (InterruptedException ex) {
            fail("Exception: " + ex);
        }
    } finally {
        exec.shutdown();
    }
}