private Object invoke(String methodName, Object... args) throws InvocationTargetException {
    Method method = methods.get(methodName);
    if (method == null) {
      throw new IllegalStateException("DuckTypedHpkSpi internal error");
    }
    try {
      return method.invoke(delegate, args);
    } catch (IllegalAccessException e) {
      throw new IllegalStateException("DuckTypedHpkSpi internal error", e);
    } catch (InvocationTargetException e) {
      if (e.getCause() instanceof RuntimeException){
        throw (RuntimeException) e.getCause();
      }
      throw e;
    }
  }
Duck typed implementation of {@link HpkeSpi}.
<p>
Will wrap any Object which implements all of the methods in HpkeSpi and delegate to them
by reflection.
common/src/main/java/org/conscrypt/DuckTypedHpkeSpi.java