Master client retry throw

Made it so master client and worker throw IOException when any TException is thrown. This is needed to prevent the inifi loop issues that we have faced in the past.
I see. In that case, do you please keep this loop logic unchanged in this PR, and leave the rest changes (e.g. catch those different exceptions)?