@Test
public void testChained() throws Exception {

    Map<String, Object> o = newLinkedHashMap();
    o.put("host", "localhost");
    o.put("port", 2);
    Config c = ConfigFactory.fromMap(o);
    final AtomicInteger i = new AtomicInteger();
    Supplier<Optional<? extends Integer>> sup = new Supplier<Optional<? extends Integer>>() {
        @Override
        public Optional<? extends Integer> get() {
            if (i.get() == 0)
                return Optional.absent();
            return Optional.of(i.get());
        }
    };
    c.getInteger("port").or(sup).or(5).addListener(new FutureCallback<Integer>() {
        @Override
        public void onSuccess(Integer result) {
            out.println("default port success: " + result);
        }
        @Override
        public void onFailure(Throwable t) {
            out.println("default port Error: " + t);
        }
    });
    o.put("port", "werwe");
    c.reload();
    i.set(12);
    c.reload();
}