// loop through response headers to set new cookies
setCookies(conn.getHeaderFields().get("Set-Cookie"));
// read page
ByteCountInputStream urlIn = new ByteCountInputStream(conn.getInputStream());
Scanner sc = new Scanner(urlIn);
while (sc.hasNextLine())
out.write(sc.nextLine());
sc.close();
trafficDown += urlIn.numBytesRead();
}