### Question:
Client extends Connection { public void addRepeatedTask(Runnable r) { synchronized (repeatedTasks) { repeatedTasks.add(r); } } protected  Client(MessageIO messageIO); void addRepeatedTask(Runnable r); @Override void shutdown(); @Override void start(); double getAverageUPS();  }### Answer:
@Test public void testAddRepeatedTask() { MessageInputStream mis = mock(MessageInputStream.class); MessageOutputStream mos = mock(MessageOutputStream.class); MessageIO messageIO = new MessageIO(mis, mos); Runnable r = mock(Runnable.class); Client client = new Client(messageIO); client.addRepeatedTask(r); client.runRepeatedTasks(); verify(r).run(); }