Exemple #1
0
 /**
  * 构造函数
  *
  * @param policy 端口策略
  * @param serverAddress 服务器地址
  * @throws IOException 如果构造port失败
  */
 public TCPHttpPort(IConnectionPolicy policy, InetSocketAddress serverAddress) throws IOException {
   super(policy);
   ready = false;
   remoteClosed = false;
   remoteAddress = serverAddress;
   // 创建代理类
   proxy = new HttpProxy(this, policy.getProxyUsername(), policy.getProxyPassword());
   proxy.setProxyAddress(policy.getProxy());
   proxy.setRemoteAddress(serverAddress);
   channel = (SocketChannel) proxy.channel();
 }
Exemple #2
0
 /* (non-Javadoc)
  * @see edu.tsinghua.lumaqq.qq.IProxyHandler#proxyReady(java.net.InetSocketAddress)
  */
 public void proxyReady(InetSocketAddress bindAddress) throws IOException {
   ready = true;
   channel = (SocketChannel) proxy.channel();
   ((PortGate) getPool()).getPorter().register(this, SelectionKey.OP_READ);
 }