Adding support for client timeout

Closes #359