add a timeout for the irods connections

irods has an issue with long-lasting connections -- they turn to a
broken pipe after a while and there is no way to detect that outside of
(in the API of) pyrods. I think it is because irods uses irodsagent
processes on the server that get respawned once in a while, but I am not
sure about this. I opened a ticket for pyrods here:
https://code.google.com/p/irodspython/issues/detail?id=29

This is a workaround for the issue as the source can only be attacked by
the pyrods devs.

This patch adds a counter to each irods connection that invalidates it
after 500 uses. In my tests (where I have reproduced the issue) this
worked fine. The downside is worse performance because of less
connection reuse.

It relies on the following:
- on every connection use, the Connection's is_valid is called
- if is_valid returns false, the connection is destroyed
This is done by the current connection pool implementation and must be
upheld in any other.