Minor refactoring of the TestInputStreamDelegate to allow for reuse.