'Fake C{os.fdopen} implementation which returns C{self.readStream} for
the stdin fd and C{self.writeStream} for the stdout fd.'

def fdopen(self, fd, mode=None):

    if (fd == _WORKER_AMP_STDIN):
        self.assertIdentical(None, mode)
        return self.readStream
    elif (fd == _WORKER_AMP_STDOUT):
        self.assertEqual('w', mode)
        return self.writeStream
    else:
        raise AssertionError(('Unexpected    fd    %r' % (fd,)))
