Example of socket communication in java.