Code example for URLConnection

Methods: connectsetDoInput

0
     */ 
    private class TestURLStreamHandler extends URLStreamHandler {
        public URLConnection openConnection(URL arg0) throws IOException {
            try { 
                URLConnection con = arg0.openConnection();
                con.setDoInput(true);
                con.connect();
                return con;
            } catch (Throwable e) {
                return null; 
            } 
        } 
 
        public URLConnection openConnection(URL arg0, Proxy proxy)
                throws IOException { 
            return super.openConnection(u, proxy);
        } 
    } 
     
    /** 
Stop searching for code, let great code find you!  Add Codota to your java IDE