mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
fix: crashes (#4281)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
parent
7f7d189958
commit
fb6a4c96b8
5 changed files with 74 additions and 17 deletions
|
|
@ -55,6 +55,27 @@ class TCPInterfaceTest {
|
|||
assertArrayEquals("Heartbeat bytes should match", expectedHeartbeat, tcpInterface.capturedBytes)
|
||||
}
|
||||
|
||||
// Since startConnect is private, we'd normally need reflection or to make a internal method.
|
||||
// For now, testing keepAlive is a good first step for stability.
|
||||
@Test
|
||||
fun `sendBytes does not crash when outStream is null`() = runTest {
|
||||
val address = "192.168.1.1:4403"
|
||||
val tcpInterface =
|
||||
object : TCPInterface(service, dispatchers, address) {
|
||||
override fun connect() {}
|
||||
}
|
||||
|
||||
// This should not throw UninitializedPropertyAccessException
|
||||
tcpInterface.sendBytes(byteArrayOf(1, 2, 3))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `flushBytes does not crash when outStream is null`() = runTest {
|
||||
val address = "192.168.1.1:4403"
|
||||
val tcpInterface =
|
||||
object : TCPInterface(service, dispatchers, address) {
|
||||
override fun connect() {}
|
||||
}
|
||||
|
||||
// This should not throw UninitializedPropertyAccessException
|
||||
tcpInterface.flushBytes()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue