File dir = new File(folderName);
if (!dir.exists()) {
if (!dir.mkdir()) {
return salida;
}
}
File f = new File (folderName + "/" + fileName);
//Creamos el proxy para poder conectarnos a la URL
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("10.65.4.1", 8080));
String ruta = rutaFocus + fileName + descarga;
URL url = new URL(ruta);
HttpURLConnection uc = (HttpURLConnection) url.openConnection(proxy);
uc.connect();
int b = 0;
while (b != -1) {
b = in.read();
if (b != -1) {
out.write(b);
}
}
out.close();
in.close();
uc.connect(); int b = 0; while (b != -1) { b = in.read(); if (b != -1) { out.write(b); } } out.close(); in.close();
Pero me devuelve el error en la línea HttpURLConnection uc = (HttpURLConnection) url.openConnection(proxy)
HttpURLConnection uc = (HttpURLConnection) url.openConnection(proxy)
dando como error org.w3c.www.protocol.http.HttpException: Connect timed out.
org.w3c.www.protocol.http.HttpException: Connect timed out.