研究了一下HttpURLConnection的源码: 在使用的时候都是通过URL.openConnection()来获取HttpURLConnection对象,然后调用其connect方法进行链接,所以先从URL.penConnection()入手: /** * Returns a new connection to the resource referred to by this URL. * * @throws IOException if an error occurs while ope…