Handle IO Exception on socket connect

This fix is needed to resolve issue with "Too many open file descriptors". See sample client application  https://github.com/stolyarchukav/gg-client-test to reproduce issue.