class ServiceInvocationHandler implements InvocationHandler {

    @Override
    public Object invoke(Object proxy, final Method m, Object[] params) throws Throwable {
        if (OBJECT_METHODS.contains(m)) {
            if (m.getName().equals("equals")) {
                params = new Object[] {Proxy.getInvocationHandler(params[0])};
            }
            return m.invoke(this, params);
        }

        ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
        try {
            Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
            final Object[] paramsFinal = params;
            return AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
                @Override
                public Object run() throws Exception {
                    return m.invoke(serviceObject, paramsFinal);
                }
            });
        } catch (Throwable ex) {
            Throwable theCause = ex.getCause() == null ? ex : ex.getCause();
            throw exceptionMapper.mapException(m, theCause);
        } finally {
            Thread.currentThread().setContextClassLoader(oldCl);
        }
    }

      ServiceInvocationHandler(Object serviceObject, Class<?> iType);

}