Tests, documentation and small refactor for UserAgent

A comment on the UserAgent class:

What this class does is providing a wrapper around the backend to utilize middleware and filters. The logic for communicating with the backend and for filtering is in the UserAgent class, whereas the logic for the middleware stack is in the ShareInstance class. I think we could merge those two.

We could handle the communication with the backend with middleware. This has the advantage of decoupling backend and UserAgent and would allow for example to serve requests from multiple backends. This requires rewriting the middleware handling to support generating responses. Then we could also implement filters as middleware.

I would be glad about feedback.