Fix gerrit reconnection logic

Previously, if the immediate reconnect attempt failed, all subsequent
calls would fail in a non-SSH-y way, making dash ignore them instead
of trying to actually reconnect. This fixes that and adds a test to
verify.