Starting to extract classes that could be reused from the jmxtrans-agent module

Note that some refactoring of the tests will be required to move more stuff around.