testing/server: add hook support

A hook is a function that is called on every request, after handling it.