### Question:
ServerReflectionUtils { static <I> Function<I, TProcessor> getProcessorFactory(Class<I> interfaceClass, Class<?> serviceClass) { try { Class<?> processorClass = ThriftUtils.getClassByName(serviceClass, "Processor"); MethodHandle constructor = MethodHandles.lookup().findConstructor( processorClass, MethodType.methodType(void.class, interfaceClass) ); return LambdaUtils.uncheckedF(serverImp -> (TProcessor) constructor.invoke(serverImp)); } catch (Exception e) { throw new ThriftRuntimeException( "Unable to find processor to serviceClass " + serviceClass.getName() + " and interface " + interfaceClass.getName(), e); } }    }### Answer:
@Test(groups = "unit") public void getProcessorFactory() throws Exception { Function<DemoServer.Iface, TProcessor> factory = ServerReflectionUtils.getProcessorFactory(DemoServer.Iface.class, DemoServer.class); TProcessor processor = factory.apply(mock(DemoServer.Iface.class)); assertTrue(processor instanceof DemoServer.Processor); }