public class ClientImplementation extends Thread implements Client { String name; int id; Server server; public ClientImplementation(String name) { this.name = name; } public void update(Update event) { System.out.println(this.name + " receives: ***(" + event + ")*** "); } public void run() { while (true) { try { sleep((int)(Math.random() * 6000 + 10000)); server.broadcast(new Update(this.name + " says: Howdy!")); } catch (Exception e) { } } } public void startAsClientOf(Server server) { this.id = server.register(this); this.server = server; this.start(); } }