If a proxy server can't be contacten when using QNetworkAccessManager, the error code from the HTTP engine is not being returned properly through QNetworkReply. Instead the error code is set to QNetworkReply::UnknownNetworkError or just QNetworkReply::HostNotFoundError.
I've configured an HTTP proxy with QNetworkProxy::setApplicationProxy.
If the proxy server returns connection refused, then the error code from QNetworkReply::error() is UnknownNetworkError. The errorString() says "Proxy connection refused" though.
If the proxy server does not exist then error() returns HostNotFoundError which implies that the end host is not found rather than the proxy server. errorString() even says "Host <...> is not found", referencing the end server rather than the proxy server.