@Test
public void testAuthenticateWithToken() throws InterruptedException {

    client.webSocketFuture = CompletableFuture.completedFuture(true);
    
    String token = "ajeoslvkencmvkejshegwt=";
    client.authenticate(token);
    // Wait up to 5 seconds for asynchronous action to complete
    waitUntilTrue(5 * 1000, () -> socket.receivedMessage());
    
    assert socket.compareData("object", token);
    assert socket.compareData("op", "validate");
    assert socket.compareData("resourceName", "system.credentials");
}