This is a prerequisite to refactoring. Mainly for the client library, but the server broker application could use tests as well.