All Products
Search
Document Center

HTTPDNS:Fault injection testing

Last Updated:Dec 11, 2025

After you complete the Android SDK integration process, you can use the HTTPDNS custom resolution feature to resolve your business domain name to an invalid IP address. This helps you verify that the integration is successful. This topic describes the test methods and steps.

How it works

HTTPDNS sends resolution requests directly to Alibaba Cloud DNS servers over HTTP or HTTPS. This process bypasses the local DNS of the system to prevent resolution failures caused by the network environment.

Fault injection testing uses the custom resolution feature of HTTPDNS. You can inject a controllable resolution error by setting the resolution result for a target business domain name to an invalid IP address. When you send a network request in this fault injection environment:

  • Successful request: The system is still using the local DNS for resolution and returns a valid IP address. This indicates that the HTTPDNS integration failed.

  • Failed request: The system uses the invalid IP address returned by HTTPDNS. This indicates that the HTTPDNS integration is successful.

Prerequisites

  • Test device: An Android phone or emulator with an internet connection.

  • App status: The EMAS HTTPDNS SDK is integrated into your app.

  • Test domain name: A business domain name that is configured in the Alibaba Cloud HTTPDNS console and resolves correctly.

Test steps

Step 1: Verify normal network conditions

  1. Connect the test device to an available Wi‑Fi network and use the default DNS settings.

  2. With HTTPDNS disabled, open the app. Trigger a network request that uses a domain name, such as loading the home page or calling an API.

  3. Confirm that the request returns a valid response.

Note

This step establishes a baseline by ensuring that the app and services work correctly under normal network conditions.

Step 2: Inject a fault (custom resolution)

  1. Log in to the EMAS console.

  2. Navigate to the HTTPDNS service. In the navigation pane on the left, choose Resolution Management > Custom Resolution.

  3. Add a custom resolution rule and set it to resolve to an invalid IP address. For more information, see Configure rule-based custom DNS resolution.

Step 3: Verify in the fault injection environment

  1. Enable HTTPDNS and start the app on the test device.

  2. Trigger the same business request as in Step 1, such as loading the home page or calling an API.

  3. Observe the request result:

    Request result

    Conclusion

    Network request fails

    The domain name was resolved by HTTPDNS, which returned an invalid IP address. The network request failed. This indicates that the HTTPDNS integration is successful.

    Network request succeeds

    • The first request succeeds. This might happen if a cache miss causes a fallback to the local DNS. Wait a moment and retry.

    • If multiple requests succeed, the system is still using the local DNS for resolution and not the HTTPDNS path. It returns a normal IP address and completes the request. The HTTPDNS integration failed.

    Note

    When you use the synchronous non-blocking interface for domain name resolution, enable pre-resolution (setPreResolveHosts) and allow expired IP addresses (setEnableExpiredIp). This ensures that a resolution result is available in the local cache. This prevents a fallback to the local DNS due to a cache miss, which can compromise the accuracy of the verification.