@Override
    protected InputStream decorate(final InputStream in, final MessageDigest digest) throws IOException {
        if(null == digest) {
            log.warn("MD5 calculation disabled");
            return super.decorate(in, null);
        }
        else {
            return new DigestInputStream(in, digest);
        }
    }
@Test
    public void testDecorate() throws Exception {
        final NullInputStream n = new NullInputStream(1L);
        final S3Session session = new S3Session(new Host(new S3Protocol()));
        assertSame(NullInputStream.class, new S3SingleUploadService(session,
                new S3WriteFeature(session, new S3AccessControlListFeature(session))).decorate(n, null).getClass());
    }