stream: implement tcp handle wrapping