Java simple code: java.net.SocketException: Unexpected end of file from server

后端 未结 8 1746
盖世英雄少女心
盖世英雄少女心 2020-12-01 10:23

I wrote some simple code in Java, the method should connect to the website and return the BufferedReader.

private BufferedReader getConnection(String url_a)          


        
8条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-01 10:57

    In my case it was solved just passing proxy to connection. Thanks to @Andreas Panagiotidis.

    Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("", 80)));
    HttpsURLConnection con = (HttpsURLConnection) url.openConnection(proxy);
    

提交回复
热议问题