sPFLib/src/main/java/it/polimi/spf/lib/services/InvocationStub.java
static <E> E from(Class<E> serviceInterface, ClassLoader classLoader, Target target) {
		Utils.notNull(target, "target must not be null");
		Utils.notNull(serviceInterface, "descriptor must not be null");

		if (classLoader == null) {
			classLoader = Thread.currentThread().getContextClassLoader();
		}

		// Validate service
		ServiceValidator.validateInterface(serviceInterface, ServiceValidator.TYPE_REMOTE);
		ServiceInterface service = serviceInterface.getAnnotation(ServiceInterface.class);
		SPFServiceDescriptor desc = ServiceInterface.Convert.toServiceDescriptor(service);

		InvocationStub stub = InvocationStub.from(desc, target);
		InvocationHandler h = new InvocationHandlerAdapter(stub);
		Object proxy = Proxy.newProxyInstance(classLoader, new Class[] { serviceInterface }, h);

		return serviceInterface.cast(proxy);
	}
static <E> E from(Class<E> serviceInterface, ClassLoader classLoader, Target target) {
		Utils.notNull(target, "target must not be null");
		Utils.notNull(serviceInterface, "descriptor must not be null");

		if (classLoader == null) {
			classLoader = Thread.currentThread().getContextClassLoader();
		}

		// Validate service
		ServiceValidator.validateInterface(serviceInterface, ServiceValidator.TYPE_REMOTE);
		ServiceInterface service = serviceInterface.getAnnotation(ServiceInterface.class);
		SPFServiceDescriptor desc = ServiceInterface.Convert.toServiceDescriptor(service);

		InvocationStub stub = InvocationStub.from(desc, target);
		InvocationHandler h = new InvocationHandlerAdapter(stub);
		Object proxy = Proxy.newProxyInstance(classLoader, new Class[] { serviceInterface }, h);

		return serviceInterface.cast(proxy);
	}
Creates an invocation stub to send service invocation requests to a
target {@link Target} performing method calls. The stub is created from a
provided service interface, which must be annotated with
{@link ServiceInterface} describing the service. The method returns an
object implementing the aforementioned interface that can be used to
perform method invocation.

@param target
- the target who the service invocation requests will be
dispatched to.
@param serviceInterface
- the interface of the service.
@param classLoader
- the ClassLoader to load classes.
@return an invocation stub to perform method calls.