Fixing a few tests with issues on asynchronous .getMessageCount

We have recently changed getMessageCount to not flush on executors any longer, but some of our tests were expecting that behaviour. for that reason I replaced a few calls to .getMessageCount() to some method that will do the old semantic.
Merge pull request #1854 from clebertsuconic/upmaster

Fixing a few tests with issues on asynchronous .getMessageCount