Failed to connect to /0.0.0.0:4723/ from Instrumentation tests

I am using Android Studio + JUnit + Appium 7.3.0 on Mac OS Catalina

Have tests in folder ‘test’ and ‘androidTest’, as I need to run both unit and instrumental tests I moved instrumental tests to androidTest folder and set up configuration for it. But now I can’t run my tests as following error appear:

Connected to process 13459 on device ‘…’

org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Original error: Failed to connect to /0.0.0.0:4723 … … Caused by: android.system.ErrnoException: isConnected failed: ECONNREFUSED (Connection refused) at libcore.io.IoBridge.isConnected(IoBridge.java:275)

Appium server log has no new lines in it, so latest entry is [Appium] Appium REST http interface listener started on 0.0.0.0:4723

If I run same test but put it in ‘test’ folder it runs in Appium as expected (but that folder is for unit tests and also does not fit to my tests many of which throw this error “No instrumentation registered! Must run under a registering instrumentation.” So that’s why I moved it to androidTest folder. So I only see configuration difference so far. Anyway I did not find solution yet, please help.

Instrumentation class - androidx.test.runner.AndroidJUnitRunner.

Capabilities

DesiredCapabilities caps = DesiredCapabilities.android();

    caps.setCapability(MobileCapabilityType.DEVICE_NAME, "...");
    caps.setCapability(MobileCapabilityType.BROWSER_NAME, "");
    caps.setCapability(MobileCapabilityType.PLATFORM_VERSION, "10.0");
    caps.setCapability(MobileCapabilityType.PLATFORM_NAME,"Android");
    caps.setCapability(MobileCapabilityType.APP, "....apk");

I am facing same issue. When I stop screen recording (Appium Provided screen recorder) I get java.net.ConnectException: Failed to connect to /0.0.0.0:4723.

I am using Appium 1.22.1.