@Override
    public void requestInitialized(final ServletRequestEvent sre) {
        try {
            HttpServletRequest request = (HttpServletRequest) sre.getServletRequest();
            if (Objects.nonNull(request) && Objects.nonNull(request.getSession())) {
                HttpSession session = request.getSession();
                request.setAttribute(CLIENT_IP_NAME, sre.getServletRequest().getRemoteAddr());
                session.setAttribute(CLIENT_IP_NAME, sre.getServletRequest().getRemoteAddr());
            }
        } catch (Exception e) {
            LOG.error("request initialized error", e);
        }
    }
@Test
    public void testRequestInitialized() {
        ServletRequestEvent sre = mock(ServletRequestEvent.class);
        HttpServletRequest request = mock(HttpServletRequest.class);
        HttpSession session = mock(HttpSession.class);
        when(sre.getServletRequest()).thenReturn(request);
        when(request.getSession()).thenReturn(session);
        websocketListener.requestInitialized(sre);
        // For session will invoke request one more time.
        verify(request, times(2)).setAttribute(CLIENT_IP_NAME, sre.getServletRequest().getRemoteAddr());
        verify(session).setAttribute(CLIENT_IP_NAME, sre.getServletRequest().getRemoteAddr());
    }