Checks to see if it can connect to the broker, and optionally peeks if there are any messages in the queue