Move agent configuration to the plugin, support host override in [messaging]
Add missing unit tests.