@NotNull
  @Override
  public List<InetAddress> lookup(@NotNull String host) throws UnknownHostException {
    InetAddress address = InetAddress.getByName(host);
    if (configuration.getBoolean(SONAR_VALIDATE_WEBHOOKS_PROPERTY).orElse(SONAR_VALIDATE_WEBHOOKS_DEFAULT_VALUE)
      && (address.isLoopbackAddress() || address.isAnyLocalAddress() || isLocalAddress(address))) {
      throw new IllegalArgumentException("Invalid URL: loopback and wildcard addresses are not allowed for webhooks.");
    }
    return Collections.singletonList(address);
  }
@Test
  public void lookup_fail_on_localhost() {
    when(configuration.getBoolean(SONAR_VALIDATE_WEBHOOKS_PROPERTY))
      .thenReturn(Optional.of(true));

    Assertions.assertThatThrownBy(() -> underTest.lookup("localhost"))
      .hasMessageContaining(INVALID_URL)
      .isInstanceOf(IllegalArgumentException.class);
  }