fix for: https://issues.apache.org/jira/browse/AMQCPP-487 fix and test for: https://issues.apache.org/jira/browse/AMQCPP-488