private void postTGTCreatedEvent() {
        val request = new MockHttpServletRequest();
        if (useIP1) {
            request.setRemoteAddr(IP1);
            request.setLocalAddr(IP1);
        } else {
            request.setRemoteAddr(IP2);
            request.setLocalAddr(IP2);
        }
        request.addHeader(HttpHeaders.USER_AGENT, "test");
        ClientInfoHolder.setClientInfo(ClientInfo.from(request));
        val tgt = new MockTicketGrantingTicket("casuser");
        val event = new CasTicketGrantingTicketCreatedEvent(this, tgt, ClientInfoHolder.getClientInfo());
        applicationContext.publishEvent(event);
    }
Create a {@link MockHttpServletRequest},
set the IP, then create {@link MockTicketGrantingTicket}, then post the
{@link CasTicketGrantingTicketCreatedEvent} event to the application context for processing.
core/cas-server-core-events/src/test/java/org/apereo/cas/support/events/HttpServletRequestSimulation.java