Improve JMS Test

Loop sleeping 100ms for up to 10s instead of a hard sleep of 1s.

Stop the gateway in a finally block.