### Question:
JoypadController implements Runnable, UncaughtExceptionHandler { public synchronized boolean connect() { if (!connected) { connected = !connected; Thread t = new Thread(this); t.setUncaughtExceptionHandler(this); t.start(); return true; } return false; } private  JoypadController(String device); static JoypadController getInstance(String device); synchronized boolean connect(); synchronized void disconnect(); void addEventListener(JoypadEventListener eventListener); void removeEventListener(JoypadEventListener eventListener); @Override void run(); @Override void uncaughtException(Thread t, Throwable e);  }### Answer:
@Test public void testConnect() throws IOException { joypadController.addEventListener(joypadEventLogger); assertTrue(joypadController.connect()); assertFalse(joypadController.connect()); }