added filtering to make sure we do not create a handler for methods
which do not return void
cleaned up test cases to check when can shut down.