responseCode = response.getStatusLine().getStatusCode();
if (responseCode != 307) {
throw new IOException(String.format("Error returned from server. Status: %s - %s", responseCode, status.getReasonPhrase()));
}
} catch (IOException e) {
method.abort();
throw e;
} finally {
method.releaseConnection();
}