class AttachmentContentDownloader {

    public InputStream download(AttachmentContent attachmentContent, Duration timeout) throws IOException {
        int millisTimeout = ((Number) timeout.toMillis()).intValue();

        URL remoteURL = new URL(attachmentContent.getRemoteUrl());
        URLConnection urlConnection = remoteURL.openConnection();

        urlConnection.setConnectTimeout(millisTimeout);
        urlConnection.setReadTimeout(millisTimeout);

        InputStream downloadStream = urlConnection.getInputStream();
        return new BufferedInputStream(downloadStream);
    }

}