Livestatus.query() Retry on socket error

We add resilience to livestatus.query() by making
it retry once in case a socket error occurs.

We do this because it is relatively common that queries
are made at the exact same time as nagios reload is happening.

Fixes opinkerfi/adagios#312
I noticed while doing the unit tests that first argument of the exception is mandatory, which is not typical for exceptions, and prevented me from making exception into a side effect in the unit tests.