feat(chat): DM SSE 재연결 기반을 추가한다
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user