@Test
        void verifyGrantServiceTicketConcurrency() throws Throwable {
            val ctx = CoreAuthenticationTestUtils.getAuthenticationResult(getAuthenticationSystemSupport(),
                RegisteredServiceTestUtils.getService());
            val ticketGrantingTicket = getCentralAuthenticationService().createTicketGrantingTicket(ctx);
            val serviceTicketIds = new CopyOnWriteArrayList<>();
            Runnable runnable = () -> FunctionUtils.doUnchecked(u -> {
                for (var i = 0; i < TICKETS_PER_REQUEST; i++) {
                    val serviceName = "testDefault" + '-' + Thread.currentThread().getName() + '-' + i;
                    val mockService = RegisteredServiceTestUtils.getService(serviceName);
                    val mockCtx = CoreAuthenticationTestUtils.getAuthenticationResult(getAuthenticationSystemSupport(), mockService);
                    val serviceTicketId = getCentralAuthenticationService().grantServiceTicket(ticketGrantingTicket.getId(), mockService, mockCtx);
                    serviceTicketIds.add(serviceTicketId.getId());
                }
            });
            val threads = new ArrayList<Thread>();
            for (var i = 0; i < REQUEST_IN_BROWSER_CONCURRENCY; i++) {
                val thread = new Thread(runnable);
                thread.setName("Thread-grantServiceTicket-" + i);
                threads.add(thread);
                thread.start();
            }
            for (val thread : threads) {
                try {
                    thread.join();
                } catch (final InterruptedException e) {
                    fail(e);
                }
            }
            val ticket = getTicketRegistry().getTicket(ticketGrantingTicket.getId(), TicketGrantingTicket.class);
            assertInstanceOf(TicketGrantingTicket.class, ticket);
            val services = ticket.getServices();
            assertNotEquals(serviceTicketIds.size(), services.size());
        }
Tests methods for {@link DefaultCentralAuthenticationService}
that verify concurrent behavior with crypto enabled.

@author Fireborn Z
@since 6.5.0
core/cas-server-core/src/test/java/org/apereo/cas/DefaultCentralAuthenticationServiceLockingTests.java