fix for: https://issues.apache.org/jira/browse/AMQ-4126 Also relates to: https://issues.apache.org/jira/browse/AMQ-3996 Test case added