fix: crashes (#4281)

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
James Rich 2026-01-21 10:21:10 -06:00 committed by GitHub
parent 7f7d189958
commit fb6a4c96b8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 74 additions and 17 deletions

View file

@ -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()
}
}