怎样通过java使用socks代理访问服务器

展开全部package test;    import java.io.IOException;  import java.util.Date;    import org.apache.commons.httpclient.HttpClient;  import org.apache.commons.httpclient.HttpException;  import org.apache.commons.httpclient.UsernamePasswordCredentials;  import org.apache.commons.httpclient.auth.AuthScope;  import org.apache.commons.httpclient.methods.PostMethod;    public class test  {      public static void main(String args[])      {          HttpClient hc = new HttpClient();            System.out.println("开始时间:" + System.currentTimeMillis());          for (int i = 0; i <= 100; i++)          {                try              {                  //每10秒才会保存一次                  Thread.sleep(12000);              } catch (InterruptedException e1)              {                  // TODO Auto-generated catch block                  e1.printStackTrace();              }              Date d = new Date();              PostMethod pm = new PostMethod(                      "?type=int&name=click&time="                              + d.getTime());              try              {                    //这里写代理地址及端口  hc.getHostConfiguration().setProxy("代理地址", 端口);    //这里是用户名与密码                  UsernamePasswordCredentials creds = new UsernamePasswordCredentials(                          "用户名", "密码");                  hc.getState().setProxyCredentials(AuthScope.ANY, creds);                    hc.executeMethod(pm);                  System.out.println(pm.getResponseBodyAsString());              } catch (HttpException e)              {                  // TODO Auto-generated catch block                  e.printStackTrace();              } catch (IOException e)              {                  // TODO Auto-generated catch block                  e.printStackTrace();              }              System.out.println(i);          }          System.out.println("结束时间:" + System.currentTimeMillis());      }  }展开全部开发socks5代理服务器_IT/计算机_专业资料。摘要:用Java语言成功开发了一个...支持常见的HTTP代理和Sock4、Sock5代理,可以以用于局域网中,socket代理来连接到外网, 这里是java使用代理连接到...// 设置不需要通过代理服务器访问的主机,可以使用*...prop.setProperty("socksProxyHost",