make connection and socket timeout configurable and exception handling improved