# EspressoRemote

Artifact: [androidx.test.espresso:espresso-remote](https://developer.android.com/jetpack/androidx/releases/test-espresso) [View Source](https://cs.android.com/search?q=file:androidx/test/espresso/remote/EspressoRemote.java+class:androidx.test.espresso.remote.EspressoRemote)

*** ** * ** ***


```
class EspressoRemote : RemoteInteraction
```

<br />

*** ** * ** ***

A singleton class that facilitates communication between other Espresso instance that may be running in different processes.

This class depends on to notify about the discovery of other remote Espresso instances and provide their `https://developer.android.com/reference/android/os/Messenger.html` object to use for further IPC.

To get the instance of this object `https://developer.android.com/reference/kotlin/androidx/test/espresso/remote/EspressoRemote#getInstance()` should be called. The user of this class should then call `https://developer.android.com/reference/kotlin/androidx/test/espresso/remote/EspressoRemote#init()` prior to attempting to use any functionality of this class. Call `https://developer.android.com/reference/kotlin/androidx/test/espresso/remote/EspressoRemote#terminate()` after using EspressoRemote to release any resources. Failure to do so will lead to memory leaks and unexpected behavior.

## Summary

| ### Public functions |
|---|---|
| `synchronized https://developer.android.com/reference/java/util/concurrent/Callable.html<https://developer.android.com/reference/java/lang/Void.html!>!` | `https://developer.android.com/reference/kotlin/androidx/test/espresso/remote/EspressoRemote#createRemoteCheckCallable(org.hamcrest.Matcher<androidx.test.espresso.Root>,org.hamcrest.Matcher<android.view.View>,java.util.Map<java.lang.String,android.os.IBinder>,androidx.test.espresso.ViewAssertion)( rootMatcher: https://junit.org/junit4/javadoc/latest/org/hamcrest/Matcher.html<https://developer.android.com/reference/kotlin/androidx/test/espresso/Root!>!, viewMatcher: https://junit.org/junit4/javadoc/latest/org/hamcrest/Matcher.html<https://developer.android.com/reference/android/view/View.html!>!, iBinders: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-map/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, https://developer.android.com/reference/android/os/IBinder.html!>!, viewAssertion: https://developer.android.com/reference/kotlin/androidx/test/espresso/ViewAssertion! )` Creates a callable to run Espresso check interaction on remote processes |
| `synchronized https://developer.android.com/reference/java/util/concurrent/Callable.html<https://developer.android.com/reference/java/lang/Void.html!>!` | `https://developer.android.com/reference/kotlin/androidx/test/espresso/remote/EspressoRemote#createRemotePerformCallable(org.hamcrest.Matcher<androidx.test.espresso.Root>,org.hamcrest.Matcher<android.view.View>,java.util.Map<java.lang.String,android.os.IBinder>,androidx.test.espresso.ViewAction...)( rootMatcher: https://junit.org/junit4/javadoc/latest/org/hamcrest/Matcher.html<https://developer.android.com/reference/kotlin/androidx/test/espresso/Root!>!, viewMatcher: https://junit.org/junit4/javadoc/latest/org/hamcrest/Matcher.html<https://developer.android.com/reference/android/view/View.html!>!, iBinders: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-map/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, https://developer.android.com/reference/android/os/IBinder.html!>!, viewActions: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/androidx/test/espresso/ViewAction!>! )` Creates a callable to run a perform interaction on remote processes. |
| `java-static https://developer.android.com/reference/kotlin/androidx/test/espresso/remote/EspressoRemote!` | `https://developer.android.com/reference/kotlin/androidx/test/espresso/remote/EspressoRemote#getInstance()()` Returns an instance of `https://developer.android.com/reference/kotlin/androidx/test/espresso/remote/EspressoRemote` object. |
| `synchronized https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/test/espresso/remote/EspressoRemote#init()()` Must be called prior to using any functionality of this class. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/test/espresso/remote/EspressoRemote#isRemoteClient()()` Returns {code true} if the current Espresso instance is communicating with another Espresso instance in a remote process. |
| `synchronized https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/test/espresso/remote/EspressoRemote#terminate()()` Must be called to disable further use of this class. |

| ### Public properties |
|---|---|
| `volatile java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/test/espresso/remote/EspressoRemote#isRemoteProcess()` Represents whether the current instance is running in a remote process or not |

### Inherited Constants

From [androidx.test.espresso.remote.RemoteInteraction](https://developer.android.com/reference/kotlin/androidx/test/espresso/remote/RemoteInteraction) `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` `https://developer.android.com/reference/kotlin/androidx/test/espresso/remote/RemoteInteraction#BUNDLE_EXECUTION_STATUS() = "executionStatus"`

## Public functions

### createRemoteCheckCallable

```
synchronized fun createRemoteCheckCallable(
    rootMatcher: Matcher<Root!>!,
    viewMatcher: Matcher<View!>!,
    iBinders: (Mutable)Map<String!, IBinder!>!,
    viewAssertion: ViewAssertion!
): Callable<Void!>!
```

Creates a callable to run Espresso check interaction on remote processes

| Parameters |
|---|---|
| `rootMatcher: https://junit.org/junit4/javadoc/latest/org/hamcrest/Matcher.html<https://developer.android.com/reference/kotlin/androidx/test/espresso/Root!>!` | the root matcher to use. |
| `viewMatcher: https://junit.org/junit4/javadoc/latest/org/hamcrest/Matcher.html<https://developer.android.com/reference/android/view/View.html!>!` | the view matcher to use. |
| `iBinders: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-map/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, https://developer.android.com/reference/android/os/IBinder.html!>!` | a list of binders to pass along to the remote process instance |
| `viewAssertion: https://developer.android.com/reference/kotlin/androidx/test/espresso/ViewAssertion!` | the view assertion to use. |

| Returns |
|---|---|
| `https://developer.android.com/reference/java/util/concurrent/Callable.html<https://developer.android.com/reference/java/lang/Void.html!>!` | the Callable |

### createRemotePerformCallable

```
synchronized fun createRemotePerformCallable(
    rootMatcher: Matcher<Root!>!,
    viewMatcher: Matcher<View!>!,
    iBinders: (Mutable)Map<String!, IBinder!>!,
    viewActions: Array<ViewAction!>!
): Callable<Void!>!
```

Creates a callable to run a perform interaction on remote processes.

If there no remote Espresso currently running in a timely manner the interaction will not be executed and a `https://developer.android.com/reference/kotlin/androidx/test/espresso/remote/NoRemoteEspressoInstanceException` will be thrown.

| Parameters |
|---|---|
| `rootMatcher: https://junit.org/junit4/javadoc/latest/org/hamcrest/Matcher.html<https://developer.android.com/reference/kotlin/androidx/test/espresso/Root!>!` | the root matcher to use. |
| `viewMatcher: https://junit.org/junit4/javadoc/latest/org/hamcrest/Matcher.html<https://developer.android.com/reference/android/view/View.html!>!` | the view matcher to use. |
| `iBinders: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-map/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, https://developer.android.com/reference/android/os/IBinder.html!>!` | a list of binders to pass along to the remote process instance |
| `viewActions: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/androidx/test/espresso/ViewAction!>!` | one or more actions to execute. |

| Returns |
|---|---|
| `https://developer.android.com/reference/java/util/concurrent/Callable.html<https://developer.android.com/reference/java/lang/Void.html!>!` | a `https://developer.android.com/reference/java/util/concurrent/Callable.html` that performs the action. |

### getInstance

```
java-static fun getInstance(): EspressoRemote!
```

Returns an instance of `https://developer.android.com/reference/kotlin/androidx/test/espresso/remote/EspressoRemote` object.

### init

```
synchronized fun init(): Unit
```

Must be called prior to using any functionality of this class.

During initialization the instance of this class will be registered with .

### isRemoteClient

```
fun isRemoteClient(): Boolean
```

Returns {code true} if the current Espresso instance is communicating with another Espresso instance in a remote process.

### terminate

```
synchronized fun terminate(): Unit
```

Must be called to disable further use of this class.

During termination the instance of this class will be un-registered with and clear the list of known remote Espresso Messengers.

## Public properties

### isRemoteProcess

```
volatile java-static val isRemoteProcess: Boolean
```

Represents whether the current instance is running in a remote process or not