SocketManager error handling fixes

Reviewer: @kenchiang