| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 812 人关注过本帖
标题:http代理服务器
只看楼主 加入收藏
小爸爸
Rank: 2
等 级:论坛游民
帖 子:12
专家分:10
注 册:2013-9-13
结帖率:100%
收藏
 问题点数:0 回复次数:0 
http代理服务器
我写的一个简单代码出现了以下的错误提示,是怎么回事啊
import * ;
import * ;
public class ProxyTest{
    public static void main(String args[])throws Exception{
        Proxy proxy = null ;

        proxy = new Proxy(Proxy.Type.HTTP,new InetSocketAddress("127.0.0.1",8888));  // 实例化本地代理对象,端口为8888
        
        URL url = new URL("http://www.);
        HttpURLConnection action = (HttpURLConnection)url.openConnection(proxy);  //使用代理打开网页
        
        InputStream in =    action.getInputStream();
        
        BufferedReader br = new BufferedReader(new InputStreamReader(in,"UTF-8"));
        StringBuilder sb = new StringBuilder();
        String lin = System.getProperty("line.separator") ;
        for(String temp = br.readLine() ; temp!=null;temp = br.readLine() ){
        
            sb.append(temp+lin);
            
        }

        br.close();
        in.close();
        System.out.println(sb);   
    }
}





Exception in thread "main" Connection refused: connect
    at (Native Method)
    at (DualStackPlainSocketImpl.java:79)
    at (AbstractPlainSocketImpl.java:339)
    at (AbstractPlainSocketImpl.java:200)
    at (AbstractPlainSocketImpl.java:182)
    at (PlainSocketImpl.java:172)
    at (Socket.java:579)
    at (Socket.java:528)
    at (NetworkClient.java:180)
    at (HttpClient.java:432)
    at (HttpClient.java:484)
    at (HttpClient.java:482)
    at java.security.AccessController.doPrivileged(Native Method)
    at (HttpClient.java:481)
    at (HttpClient.java:522)
    at (HttpClient.java:211)
    at (HttpClient.java:308)
    at (HttpClient.java:326)
    at (HttpURLConnection.java:996)
    at (HttpURLConnection.java:975)
    at (HttpURLConnection.java:850)
    at (HttpURLConnection.java:1300)
    at ProxyTest.main(ProxyTest.java:12)
搜索更多相关主题的帖子: 代理服务器 public action import null 
2015-05-26 18:39
快速回复:http代理服务器
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.022536 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved