I am trying to write a simple Java program using a ServerSocket to listen on port 4000 on my server. When a client connects to port 4000, I want the program to "redirect" the client to port 5000, where another unrelated program is currently listening. The client will ideally not be aware of this redirect.
Is there a simple way to achieve this in Java?