-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Barebones test and proxy interface for issue #865
- Loading branch information
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
android-test-common/src/main/java/com/ably/tracking/test/android/common/AblyProxy.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.ably.tracking.test.android.common | ||
|
||
import io.ably.lib.realtime.AblyRealtime | ||
import io.ably.lib.types.ClientOptions | ||
|
||
sealed class ProtocolAction { | ||
/** | ||
* `presence.enter` realtime protocol action | ||
*/ | ||
object PresenceEnter : ProtocolAction() | ||
// ... | ||
} | ||
|
||
sealed class ProxyResponse { | ||
/** | ||
* Terminate the connection when configured action has been detected | ||
*/ | ||
object Disconnect : ProxyResponse() | ||
// ... | ||
} | ||
|
||
interface RealtimeProxy { | ||
/** | ||
* Return an AblyRealtime client that has been congfigured to pass traffic | ||
* through the proxy | ||
*/ | ||
fun proxy(opts: ClientOptions) : AblyRealtime | ||
|
||
/** | ||
* Configure proxy to give specified response when given protocol action | ||
* occurs across proxied traffic. All other actions pass through. | ||
*/ | ||
fun onAction(action: ProtocolAction, response: ProxyResponse) | ||
|
||
/** | ||
* Reset any configured responses/actions so that all traffic is back to pass-through. | ||
*/ | ||
fun reset() | ||
} |
14 changes: 14 additions & 0 deletions
14
...tion-testing-app/src/androidTest/java/com/ably/tracking/tests/NetworkConnectivityTests.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.ably.tracking.tests | ||
|
||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import org.junit.Assert | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
@RunWith(AndroidJUnit4::class) | ||
class NetworkConnectivityTests { | ||
@Test | ||
fun emptyTest() { | ||
Assert.assertTrue(true) | ||
} | ||
} |