TEZ-1102. Abstract out connection management logic in shuffle code.
Contributed by Rajesh Balamohan.