Added Fix and tests for https://issues.apache.org/jira/browse/AMQ-4906