	@Test
	public void testFailRewirePipe() {

		final ValueHolder<String> preRewireValue = new ValueHolder<String>();
		final ValueHolder<String> postRewireValue = new ValueHolder<String>();

		Callable<Integer> task = new Callable<Integer>() {
			public Integer call() {
				throw new RuntimeException("oops");
			}
		};

		deferredManager.when(task).pipe(null, new FailPipe<Throwable, Integer, String, Void>() {
			@Override
			public Promise<Integer, String, Void> pipeFail(Throwable result) {
				preRewireValue.set(result.getMessage());
				return new DeferredObject<Integer, String, Void>().reject("ouch");
			}
		}).fail(new FailCallback<String>() {
			@Override
			public void onFail(String result) {
				postRewireValue.set(result);
			}
		});

		waitForCompletion();
		preRewireValue.assertEquals("oops");
		postRewireValue.assertEquals("ouch");
	}