INT-2884: Refactor Stream Tests to Use Mocks

Avoid hijacking stdout, stderr because the tests failed
when logging was enabled.
Merge pull request #721 from artembilan/INT-2884