Added cleaner thread

Added a thread to perform the various cleanup tasks such as detecting
response timeouts and cleaning out expired connections.