Saying `@socket && !@socket.closed?` seems better here.