When I have updated my sdk version from API 26 to API 28, OKHttp mockserver fails to run in the device/emulator in my android instrumentation test. It ran perfectly in the older versions. I have checked in the Network Config
<network-security-config>
<domain-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="false">localhost</domain>
<domain-config>
</domain-config>
</network-security-config>
I figured out by changing the cleartext value in the base-config. May be it will useful to some one.
<network-security-config>
<base-config cleartextTrafficPermitted="true" />
</network-security-config>