private <T extends SyncDockerCmd<R>, R> T wrappedCommand(
        Class<T> clazz,
        T cmd,
        BiConsumer<T, R> successConsumer,
        BiConsumer<T, Exception> failureConsumer
    ) {
        return (T) Proxy.newProxyInstance(
            clazz.getClassLoader(),
            new Class<?>[] { clazz },
            (proxy, method, args) -> {
                if (method.getName().equals("exec")) {
                    try {
                        R r = (R) method.invoke(cmd, args);
                        successConsumer.accept(cmd, r);
                        return r;
                    } catch (Exception e) {
                        if (e instanceof InvocationTargetException && e.getCause() instanceof Exception) {
                            e = (Exception) e.getCause();
                        }
                        failureConsumer.accept(cmd, e);
                        throw e;
                    }
                } else {
                    return method.invoke(cmd, args);
                }
            }
        );
    }
Wrapper for {@link DockerClient} to facilitate 'audit logging' of potentially destruction actions using
{@link org.testcontainers.utility.AuditLogger}.
core/src/main/java/org/testcontainers/dockerclient/AuditLoggingDockerClient.java