### Question:
ReflectConfigurator { public <I, T extends TServiceClient> SyncClientClassInfo<I, T> createSync(Class<I> thriftInterface){ Class<?> root = thriftInterface.getDeclaringClass(); if (!"Iface".equals(thriftInterface.getSimpleName()) || root == null){ throw new IllegalArgumentException(thriftInterface.getName() + " isn't thrift async client interface"); } Class<?> clientClass = ThriftUtils.getClassByName(root, "Client"); Class<?> factoryClass = ThriftUtils.getClassByName(clientClass, "Factory"); Class<? extends TServiceClientFactory> factoryCast = factoryClass.asSubclass(TServiceClientFactory.class); TServiceClientFactory<T> clientFactory; try { clientFactory = factoryCast.getConstructor().newInstance(); } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException ex) { throw new IllegalArgumentException( "Unable to create client factory " + factoryClass.getName() + " for " + thriftInterface.getName(), ex ); } Optional<MethodHandle> validatorMethod = findValidatorMethod(thriftInterface); Optional<Predicate<I>> validator = validatorMethod.map(method -> { if (method.type().returnType().equals(void.class)) { LambdaUtils.ThrowingPredicate<I> predicate = client -> { method.invoke(client); return true; }; return LambdaUtils.uncheckedP(predicate); } else { return LambdaUtils.uncheckedP(client -> (Boolean) method.invoke(client)); } }); return new SyncClientClassInfo<I, T>(thriftInterface, clientFactory, validator); }  SyncClientClassInfo<I, T> createSync(Class<I> thriftInterface); AsyncClientClassInfo<I, T> createAsync(Class<I> thriftInterface);  }### Answer:
@Test(groups = "unit") public void createSync() throws Exception { SyncClientClassInfo<DemoServer.Iface, DemoServer.Client> info = configurator.createSync(DemoServer.Iface.class); assertEquals(info.getClientInterfaceClazz(), DemoServer.Iface.class); assertEquals(info.getClientFactory().getClass(), DemoServer.Client.Factory.class); DemoServer.Iface mock = mock(DemoServer.Iface.class); when(mock.healthCheck()).thenReturn(true); assertTrue(info.getValidator().get().test(mock)); verify(mock, times(1)).healthCheck(); SyncClientClassInfo<SecondServer.Iface, SecondServer.Client> info2 = configurator.createSync(SecondServer.Iface.class); SecondServer.Iface mock2 = mock(SecondServer.Iface.class); assertTrue(info2.getValidator().get().test(mock2)); verify(mock2, times(1)).test(); }