Guard against nil socket.gets responses

In the situation where the socket has only one line to respond with, any
following gets to the socket need to take care to not assume there is a
non-nil response.