@Override
    public T call() throws BackgroundException {
        while(!cancel.isCanceled()) {
            try {
                return delegate.call();
            }
            catch(BackgroundException e) {
                if(!this.retry(e, listener, cancel)) {
                    throw e;
                }
                // Try again
            }
        }
        throw new ConnectionCanceledException();
    }
@Test
    public void testCall() throws Exception {
        final AtomicInteger count = new AtomicInteger();
        final DefaultRetryCallable<Void> c = new DefaultRetryCallable<>(new Host(new TestProtocol(Scheme.file)), 1, 0, new BackgroundExceptionCallable<Void>() {
            @Override
            public Void call() throws BackgroundException {
                count.incrementAndGet();
                throw new ConnectionRefusedException("d", new SocketException());
            }
        }, new DisabledProgressListener(), new TransferBackgroundActionState(new TransferStatus()));
        try {
            c.call();
            fail();
        }
        catch(ConnectionRefusedException e) {
            // Expected
        }
        assertEquals(2, count.get());
    }