feat(chat): DM SSE 재연결 기반을 추가한다

This commit is contained in:
2026-06-11 11:16:19 +09:00
parent e19442a61a
commit 871f4e73e8
3 changed files with 64 additions and 6 deletions

View File

@@ -66,6 +66,31 @@ class DmChatEventClientTest {
assertEquals("안녕하세요", receivedMessage?.textMessage)
}
@Test
fun `취소되지 않은 SSE stream이 EOF로 종료되면 failure callback으로 전달된다`() {
val failureLatch = CountDownLatch(1)
var failure: Throwable? = null
val client = clientWithResponse(
code = 200,
body = "event: connected\n\n"
)
client.connect(
token = "test-token",
roomId = 10L,
listener = object : TestListener() {
override fun onFailure(throwable: Throwable) {
failure = throwable
failureLatch.countDown()
}
}
)
failureLatch.await(2, TimeUnit.SECONDS)
assertNotNull(failure)
assertEquals("SSE stream closed", failure?.message)
}
private fun clientWithResponse(
code: Int,
body: String