Network Mocking with Appium

Hi,
I have been using Appium (UiAutomator2 and XCUITest) to perform cross platform UI testing of native mobile applications. At times I feel helpless due to limited capabilities of Appium as it is primarily a black box end-to-end testing tool and it is not easy to have access to network calls being made from/to application under test.
I explored Internet to find some solutions and possibilities that can be combined with Appium to record network traffic and stub the response with custom data to test different scenarios that rely in certain response being returned by the mobile app.
For manual testing, it is relatively easier to achieve mocking with tools like Charles Proxy, Proxyman etc. but i would like to integrate the mocking with automated tests run via Appium Java client.
I found some online articles where people shared the approach to integrate WireMock with Appium:-

For the recording network traffic part, it seems easier where you proxy is configured on devices to direct all the traffic to wiremock server running locally on system which records all the network calls.

But what i do not understand is how do I direct all the network calls from application under test to the wiremock server. What settings are required and where do these settings must be applied so all the network calls from real devices/emulator/simulator instead point to the wiremock server which should then be able to return the response to app either the same recorded response or stub the mocked response.

Also when mocking the requests via tools like Charles or Proxy, we are required to install some CA certificate on the devices, how and where does this part come into play when we want to mock requests using Appium. Does this need to be done manually only once, or it can be done also programtically?

Also is it possible to mock only a certain request made by app and that too only after a certain UI action is performed on the app by Appium i.e. i do not want to mock all the traffic rather i only want to mock the response of a particular call at the particular stage of UI test so that the rest of traffic goes through the usual backend server.

I also came across this Appium plugin but it does not support iOS

Another solution I came across is a Java rendition of node-mitmproxy, however I am not really sure if it is updated and works well for both platforms and also on real devices.

It would be really helpful if someone could share their strategies and approaches on how you perform mocking with Appium using Wiremock or any other proxy server. Since I am using Appium Java client, so i am searching for solutions compatible with Java language binding.

Considering it would be really helpful to have the possibility of mocking supported/integrated in Appium using some other tools, do you think this feature should/could be adopted by the Appium team officially to incorporate in Appium?

Same as with Charles → Add in phone network connection proxy where wiremock server listening. Normally just add it into WiFi connection of Android or iOS phone.