code: private static InetAddress getLocalHostBySocket(InetSocketAddress remoteAddress) {
          InetAddress host = null;
          try {
              // 去连一下远程地址
              Socket socket = new Socket();
              try {
                  socket.connect(remoteAddress, 1000);
                  // 得到本地地址
                  host = socket.getLocalAddress();
              } finally {
                  IOUtils.closeQuietly(socket);
              }
          } catch (Exception e) {
              LOGGER.warn("Can not connect to host {}, cause by :{}",
                  remoteAddress.toString(), e.getMessage());
          }
          return host;
      }
docs: 通过连接远程地址得到本机内网地址
  
  @param remoteAddress 远程地址
  @return 本机内网地址