public static String getRemoteIp(HttpServletRequest request) {
        String remoteIp = RequestContextHolder.getContext().getBasicContext().getAddressContext().getSourceIp();
        if (StringUtils.isBlank(remoteIp)) {
            remoteIp = RequestContextHolder.getContext().getBasicContext().getAddressContext().getRemoteIp();
        }
        if (StringUtils.isBlank(remoteIp)) {
            remoteIp = WebUtils.getRemoteIp(request);
        }
        return remoteIp;
    }
@Test
    void testGetRemoteIpFromRequest() {
        HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
        
        Mockito.when(request.getRemoteAddr()).thenReturn("127.0.0.1");
        assertEquals("127.0.0.1", RequestUtil.getRemoteIp(request));
        
        Mockito.when(request.getHeader(eq(X_REAL_IP))).thenReturn("127.0.0.2");
        assertEquals("127.0.0.2", RequestUtil.getRemoteIp(request));
        
        Mockito.when(request.getHeader(eq(X_FORWARDED_FOR))).thenReturn("127.0.0.3");
        assertEquals("127.0.0.3", RequestUtil.getRemoteIp(request));
        
        Mockito.when(request.getHeader(eq(X_FORWARDED_FOR))).thenReturn("127.0.0.3, 127.0.0.4");
        assertEquals("127.0.0.3", RequestUtil.getRemoteIp(request));
        
        Mockito.when(request.getHeader(eq(X_FORWARDED_FOR))).thenReturn("");
        assertEquals("127.0.0.2", RequestUtil.getRemoteIp(request));
        
        Mockito.when(request.getHeader(eq(X_REAL_IP))).thenReturn("");
        assertEquals("127.0.0.1", RequestUtil.getRemoteIp(request));
    }