refactor some transport logic, and add basic urllib based transport