@Override
    public int read(final byte[] b) throws IOException {
        return this.read(b, 0, b.length);
    }
@Test
    public void testEncryptDecryptWithContentSizeMultipleOfEncryptingBufferSize() throws Exception {
        final byte[] content = RandomUtils.nextBytes(1024 * 1024);
        final ByteArrayInputStream plain = new ByteArrayInputStream(content);
        final PlainFileKey key = Crypto.generateFileKey(PlainFileKey.Version.AES256GCM);
        final SDSSession session = new SDSSession(new Host(new TestProtocol()), new DisabledX509TrustManager(), new DefaultX509KeyManager()) {
            @Override
            public SDSApiClient getClient() {
                return new SDSApiClient(new MockHttpClient());
            }
        };
        final TransferStatus status = new TransferStatus();
        final ObjectWriter writer = session.getClient().getJSON().getContext(null).writerFor(FileKey.class);
        final ByteArrayOutputStream out = new ByteArrayOutputStream();
        writer.writeValue(out, TripleCryptConverter.toSwaggerFileKey(key));
        status.setFilekey(ByteBuffer.wrap(out.toByteArray()));
        final TripleCryptEncryptingInputStream encryptInputStream = new TripleCryptEncryptingInputStream(session, plain, Crypto.createFileEncryptionCipher(key), status);
        final ByteArrayOutputStream os = new ByteArrayOutputStream();
        new StreamCopier(StreamCancelation.noop, StreamProgress.noop).withLimit((long) content.length).withChunksize(32768).transfer(encryptInputStream, os);
        encryptInputStream.close();
        out.close();
        final ByteArrayInputStream is = new ByteArrayInputStream(os.toByteArray());
        final ObjectReader reader = session.getClient().getJSON().getContext(null).readerFor(FileKey.class);
        final FileKey fileKey = reader.readValue(status.getFilekey().array());
        assertNotNull(fileKey.getTag());
        final TripleCryptDecryptingInputStream cryptInputStream = new TripleCryptDecryptingInputStream(is,
                Crypto.createFileDecryptionCipher(TripleCryptConverter.toCryptoPlainFileKey(fileKey)),
                TripleCryptConverter.base64StringToByteArray(fileKey.getTag()));
        final byte[] compare = new byte[content.length];
        IOUtils.read(cryptInputStream, compare);
        assertArrayEquals(content, compare);
    }