public static SphereClientFactory of() { return new SphereClientFactory(); }
public static SphereClientFactory of() { try { Class<?> clazz; try { clazz = Class.forName("io.sphere.sdk.client.SphereAsyncHttpClientFactory"); } catch (final ClassNotFoundException e) { clazz = Class.forName("io.sphere.sdk.client.SphereApacheHttpClientFactory"); } final Method create = clazz.getMethod("create"); final Supplier<HttpClient> supplier = () -> { try { return (HttpClient) create.invoke(null); } catch (IllegalAccessException | InvocationTargetException e) { throw new SphereException(e); } }; return of(supplier); } catch (ClassNotFoundException | NoSuchMethodException e) { throw new SphereException(e); } }