    @Test
    public void testShouldAbort() throws InterruptedException {

        final List<Integer> abortionCount = new ArrayList<Integer>();

        Thread t = new Thread(new Runnable() {

            @Override
            public void run() {

                ByteArrayInputStream bais = new ByteArrayInputStream(
                        "Content".getBytes(StringUtils.UTF8));
                TestInputStream tis = new TestInputStream(bais);

                long counter = 0;
                while (counter < Long.MAX_VALUE) {
                    counter++;
                    if (Thread.currentThread().isInterrupted()) {
                        try {
                            tis.abortIfNeeded();
                        } catch (AbortedException e) {
                        }
                        abortionCount.add(tis.getAbortions());
                        break;
                    }
                }

            }

        });

        t.start();
        Thread.sleep(1000);
        t.interrupt();
        Thread.sleep(1000);
        assertEquals(abortionCount.size(), 1);
        assertEquals(abortionCount.get(0), new Integer(1));
    }