class RedirectUtil {

    @NonNull
    public static String getRedirectedUrl(DownloadConnection.Connected connected, int responseCode)
            throws IOException {
        String url = connected.getResponseHeaderField("Location");
        if (url == null) {
            throw new ProtocolException(
                    "Response code is " + responseCode + " but can't find Location field");

        }
        return url;
    }

}