backport to 1.8.7. Included commit from Grisha. Added in socket timeout
for Hiveserver1.