When stream is NULL it means reads should read 0 bytes and writes should fake success with no side effects.