我终于明白了。
我只需要使用普通套接字,并向客户端发送一条消息,表明已建立连接。然后继续挖掘。
这是一个工作代码:
private Socket socket = null; private Socket remoteSocket = null; private HTTPReqHeader request = null; ClientHandler(Socket socket) {this.socket = socket;request = new HTTPReqHeader();request.parse(socket); // I read and parse the HTTP request here } public void run() { remoteSocket = new Socket(request.url,request.port); if(request.isSecure() ) { // send ok message to client String ConnectResponse = "HTTP/1.0 200 Connection establishedn" + "Proxy-agent: ProxyServer/1.0n" + "rn"; try {DataOutputStream out = new DataOutputStream(socket.getOutputStream()); out.writeByte(ConnectResponse); out.flush(); } catch(Exception e) {} } // start connecting remoteSocket and clientSocket ........... }这是有关代理服务器如何处理CONNECT的很好的解释。 http://curl.haxx.se/rfc/draft-luotonen-web-proxy-
tunneling-01.txt



