Adding support for server timeouts

Closes #360