Throw when trying to publish without being connected (should throw a proper exception)