Catch IOException instead of SocketException