I try to connect to an url, one simple because after i want to connect to a server. For this i have
String urlServer = "http://www.google.com";
URL url = new URL(urlServer);
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setUseCaches(false);
connection.setRequestMethod("POST");
outputStream = new DataOutputStream( connection.getOutputStream() );
The last line goes to the catch exception. I don't know what happens, I have also tried with this
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("10.0.0.1", 8080));
conn = new URL(urlString).openConnection(proxy);
and it gives me
true
The LogCat gives me
android.os.NetworkOnMainThreadException