retrofit-mock/src/main/java/retrofit2/mock/NetworkBehavior.java
@SuppressWarnings("ConstantConditions") // Guarding public API nullability.
  public void setErrorFactory(Callable<Response<?>> errorFactory) {
    if (errorFactory == null) {
      throw new NullPointerException("errorFactory == null");
    }
    this.errorFactory = errorFactory;
  }
@SuppressWarnings("ConstantConditions") // Guarding public API nullability.
  public void setErrorFactory(Callable<Response<?>> errorFactory) {
    if (errorFactory == null) {
      throw new NullPointerException("errorFactory == null");
    }
    this.errorFactory = errorFactory;
  }
Set the error response factory to be used when an error is triggered. This factory may only
return responses for which {@link Response#isSuccessful()} returns false.