CHRON-56 Refactor TCP layer, fix OSX selector loop