Skip to content

Commit

Permalink
Barebones test and proxy interface for issue #865
Browse files Browse the repository at this point in the history
  • Loading branch information
jaley committed Dec 28, 2022
1 parent 63c5295 commit d4e5af6
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
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()
}
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)
}
}

0 comments on commit d4e5af6

Please sign in to comment.