refactored JMX support and added test cases