Abstract TCP communications a bit to allow for SSL