Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibaultBee committed Nov 19, 2024
1 parent c11dd64 commit 62defce
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
import java.io.File
import java.lang.Thread.sleep
import java.net.InetAddress
import java.util.UUID
import java.util.concurrent.Callable
Expand Down Expand Up @@ -41,13 +42,14 @@ class SrtSocketSendRecvFileTest {
val message = UUID.randomUUID().toString()
val sendFile = Utils.createTestFile(message = message)

val futureResult = server.enqueue(sendFile)
socket.connect(InetAddress.getLoopbackAddress(), server.port)

val recvFile = File(
InstrumentationRegistry.getInstrumentation().context.externalCacheDir,
UUID.randomUUID().toString()
)

val futureResult = server.enqueue(sendFile)
socket.connect(InetAddress.getLoopbackAddress(), server.port)

assertEquals(sendFile.length(), socket.recvFile(recvFile, size = sendFile.length()))
assertEquals(sendFile.length(), futureResult.get())
}
Expand All @@ -69,6 +71,7 @@ class SrtSocketSendRecvFileTest {
serverSocket.listen(1)
val pair = serverSocket.accept()
val comSocket = pair.first
sleep(1000)
val numOfSentBytes = comSocket.sendFile(file)
comSocket.close()
numOfSentBytes
Expand Down

0 comments on commit 62defce

Please sign in to comment.