@Override
    public StorageObject upload(final Path file, Local local, final BandwidthThrottle throttle, final StreamListener listener,
                                final TransferStatus status, final ConnectionCallback prompt) throws BackgroundException {
        if(this.threshold(status)) {
            try {
                return new S3MultipartUploadService(session, writer, acl).upload(file, local, throttle, listener, status, prompt);
            }
            catch(NotfoundException | InteroperabilityException e) {
                log.warn(String.format("Failure %s using multipart upload. Fallback to single upload.", e));
                status.append(false);
                try {
                    return new S3SingleUploadService(session, writer).upload(file, local, throttle, listener, status, prompt);
                }
                catch(BackgroundException f) {
                    log.warn(String.format("Failure %s using single upload. Throw original multipart failure %s", e, e));
                    throw e;
                }
            }
        }
        // Use single upload service
        return new S3SingleUploadService(session, writer).upload(file, local, throttle, listener, status, prompt);
    }
@Test(expected = NotfoundException.class)
    public void testUploadInvalidContainer() throws Exception {
        final S3ThresholdUploadService m = new S3ThresholdUploadService(session, new S3AccessControlListFeature(session), 5 * 1024L);
        final Path container = new Path("nosuchcontainer.cyberduck.ch", EnumSet.of(Path.Type.directory, Path.Type.volume));
        final Path test = new Path(container, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file));
        final Local local = new NullLocal(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString());
        final TransferStatus status = new TransferStatus().withLength(5 * 1024L);
        m.upload(test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledStreamListener(), status, null);
    }