refactor socket channel/connection/envelope paradigm