Hello all ,
i have this set up :

internet
|
Router(Suse) ---- Content-Filter Server
|
LAN

am using iptables ( on the Router " Suse " ) to redirect client httprequests from Port 80 to my program's port (1500) that i developed on the router now in my code i want to send ( redirect ) all client http requests to the Content-filter server's port ( Squid-Server at 3128) and here is the code please ,

Java Code:
import java.io.*;
import java.net.*;

public class Test {

public static void main(String[] args) {

try {
ServerSocket serverSocket = new ServerSocket(1406);
while(true){
System.out.println("Waiting for request");
Socket socket = serverSocket.accept();
new Thread(new SimpleHttpHandler(socket)).run();
socket.close();
}
}
catch (Exception e) {
e.printStackTrace();
}
}
}

class SimpleHttpHandler implements Runnable{

private final static String CLRF = "\r\n";

private Socket client;
private DataOutputStream writer;
private BufferedReader reader;

public SimpleHttpHandler(Socket client){

this.client = client;
}

public void run(){

try{

this.reader = new BufferedReader(
new InputStreamReader(
this.client.getInputStream()
)
);

InetAddress ipp=InetAddress.getByName("192.168.6.29"); //192.168.6.29 ip of the proxy server
System.out.println(ipp);
StringBuffer buffer = new StringBuffer();
Socket ss=new Socket(ipp,3128);
this.writer= new DataOutputStream(ss.getOutputStream());
writer.writeBytes(this.read());

this.writer.close();
this.reader.close();
this.client.close();
}
catch(Exception e){
e.printStackTrace();
}
}

private String read() throws IOException{
String in = "";
StringBuffer buffer = new StringBuffer();
while(!(in = this.reader.readLine()).trim().equals("")){
buffer.append(in + "\n");

}
System.out.println(buffer.toString());
return buffer.toString();
}

}
my probelm is as follows :

1) i can read the httpRequest from the client and i could output it and it's correct

2)am not sure about the way that am using to send the httpRequest to Squid-Server, becuase my clients don't get response ( am i reading correctly the whole httpRequest ? is this the correct way to redirect the httpRequest to the Proxy-Server ?

Best regards,
Tareq