fixed TCP middleware to actually connect