mirror of
https://github.com/logos-storage/logos-storage-nim-validator.git
synced 2026-01-06 23:43:09 +00:00
18 lines
586 B
Nim
18 lines
586 B
Nim
import ./basics
|
|
import codexvalidator/network
|
|
|
|
suite "Network communication":
|
|
|
|
test "a connection can be made to a server":
|
|
let server = !await NetworkServer.open()
|
|
let address = !server.address
|
|
let connection = !await NetworkConnection.connect(address)
|
|
await connection.close()
|
|
await server.close()
|
|
|
|
test "connect can fail":
|
|
let address = !NetworkAddress.init("127.0.0.1:1011") # port reserved by IANA
|
|
let connection = await NetworkConnection.connect(address)
|
|
check connection.isFailure
|
|
check connection.error.msg.contains("Connection refused")
|