### Question:
ConnectEventListener implements EventListener { @Override public void handleEvent(Event e) { final ConnectEvent connEvent = (ConnectEvent) e; final Connection conn = connEvent.getConn(); if (conn == null) { return; } final ConnectEvent.EventType type = connEvent.getEventType(); boolean reconnect = false; if (type == ConnectEvent.EventType.CLOSE || type == ConnectEvent.EventType.RECONNECT || type == ConnectEvent.EventType.EXCEPTION) { reconnect = reconnects.putIfAbsent(conn.getID(), Boolean.TRUE) == null; } if (reconnect) { conn.reconnect = true; retryExecutor.execute(new RetryTask("Reconnect-" + conn.getID(), retryPolicy, retryExecutor, new RetryCallback() { @Override public boolean execute() { return conn.reConnect(); } @Override public void onTerminate(boolean success) { reconnects.remove(conn.getID()); conn.reconnect = false; } })); conn.logEvent(ConnectEvent.EventType.RECONNECT); } } ConnectEventListener(ScheduledExecutorService retryExecutor); @Override String getName(); @Override boolean isSupport(Event e); @Override void handleEvent(Event e);  }### Answer:
@Test public void handleEventTest() { ScheduledExecutorService retryExecutor = Executors.newSingleThreadScheduledExecutor(); ConnectEventListener listener = new ConnectEventListener(retryExecutor); Connection conn = pool.getConn(); conn.connect(); Assert.assertEquals(true, conn.isActive()); conn.getChannel().close(); sleep(1000); Assert.assertEquals(false, conn.isActive()); ConnectEvent connectEvent = new ConnectEvent(conn, ConnectEvent.EventType.CLOSE); listener.handleEvent(connectEvent); sleep(1000); Assert.assertEquals(true, conn.isActive()); }