forwardHost = uri.substring(0, idx);
forwardPort = Integer.parseInt(uri.substring(idx + 1, uri.length()));
}
try {
INonBlockingConnection forwardCon = new NonBlockingConnection(forwardHost, forwardPort);
INonBlockingConnection tcpCon = exchange.getConnection().getUnderlyingTcpConnection();
forwardCon.setAttachment(tcpCon);
tcpCon.setAttachment(forwardCon);
forwardCon.setFlushmode(FlushMode.ASYNC);
forwardCon.setAutoflush(true);
tcpCon.setFlushmode(FlushMode.ASYNC);
tcpCon.setAutoflush(true);
forwardCon.setHandler(new TcpProxyHandler());
tcpCon.setHandler(new TcpProxyHandler());
IHttpResponse response = new HttpResponse(200);
response.getResponseHeader().setReason("Connection established");
response.setHeader("Proxy-agent", "myProxy");