Improved testing to handle termination of producer