add stream code and test code