真机测试HttpURLConnection获取不到数据 用HttpClinet又可以 5.0系统

            URL url=new URL("http://www.baidu.com");
            connection =(HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            InputStream in =connection.getInputStream();

            HttpClient client = new DefaultHttpClient();
            HttpGet get = new HttpGet("http://www.baidu.com");
            HttpResponse response =client.execute(get);
            HttpEntity entity =response.getEntity();
            InputStream in = entity.getContent();

看看是不是dns解析的问题,是随机出现的么,返回什么错误
http://blog.csdn.net/hguang_zjh/article/details/33743249

4.4版本的模拟器上这2种都可以,没有错误返回