See the full source code of this recipe at https://github.com/eldermoraes/javaee8-cookbook/tree/master/chapter09/ch09-proxy-task.