CORE-5505: fixed a bug that prevented socket exceptions from being caught and added some additional logging