android java.net.ProtocolException:已建立连接

aco*_*der 1 java android

public static Bitmap getImage(String address) throws Exception {

    Bitmap imgmap = null;
    InputStream is = null;

    URL url = new URL(address);

    HttpURLConnection  conn = (HttpURLConnection)url.openConnection();
    try {
        conn.setRequestMethod("GET"); >>> here was been excuted,but go to finally block
        conn.setConnectTimeout(5000); 
        is = conn.getInputStream();
        byte[] imgbytes = StreamTool.getBytes(is);
        imgmap = BitmapFactory.decodeByteArray(imgbytes, 0, imgbytes.length);

    } finally {
        if (is != null) {
            is.close();
        }
        if (conn != null) {
            conn.disconnect();
        }
    }

    return imgmap;
}
Run Code Online (Sandbox Code Playgroud)

conn.setRequestMethod("GET")被解雇之前,Thorw异常连接已经建立.谁能给我一个解决方案

Vah*_*iri 7

我知道这完全是胡说八道.但是当我在此行上设置断点时,它会在调试模式下发生.

con.setRequestMethod()

一旦我删除了断点,错误就消失了!