You have to send the packets to Server2 just after receiving them from the client in Server1.
Untested Server1 snippet:
socket1 = new Socket(address, 5001);
out = new DataOutputStream(socket1.getOutputStream());
while (!line.equals("Over"))
{
try
{
line = in1.readUTF();
System.out.println(line);
out.writeUTF(line);
}
catch(IOException i)
{
System.out.println(i);
}
}
Your code is opening the connection to Server2 when the client has finished communication by sending "Over".
Note also that your current code of both servers will terminate when a client finished the communication. A normal server would not do that but enter listening state again to accept further connections from clients.