optimization on direct-delivery + test fix

original pr:

https://github.com/hornetq/hornetq/pull/823