use of org.pircbotx.hooks.events.DisconnectEvent in project downlords-faf-client by FAForever.
the class PircBotXChatServiceTest method testAddOnChatDisconnectedListener.
@Test
public void testAddOnChatDisconnectedListener() throws Exception {
CompletableFuture<Void> onChatDisconnectedFuture = new CompletableFuture<>();
instance.connectionState.addListener((observable, oldValue, newValue) -> {
switch(newValue) {
case DISCONNECTED:
onChatDisconnectedFuture.complete(null);
break;
}
});
connect();
CompletableFuture<Void> future = listenForDisconnected();
firePircBotXEvent(new DisconnectEvent(pircBotX, daoSnapshot, null));
future.get(TIMEOUT, TIMEOUT_UNIT);
onChatDisconnectedFuture.get(TIMEOUT, TIMEOUT_UNIT);
}
Aggregations