I have done this using RMI instead of socket programming.If you have problem with normal java RMI, then use the Spring
RMI samples available in to the net.

Good Luck