-
Notifications
You must be signed in to change notification settings - Fork 57
/
client_listen_test.jl
44 lines (39 loc) · 1.48 KB
/
client_listen_test.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# included in runtests.jl
# Very similar to client_serverWS_test.jl
# Test sending / receiving messages correctly,
# closing from within websocket handlers,
# symmetry of client and server side websockets,
# stress tests opening and closing a sequence of servers.
# At this time, we unfortunately get irritating messages
# 'Workqueue inconsistency detected:...'
# @info "External server http request"
# @test 200 == HTTP.request("GET", EXTERNALHTTP).status
@info "Listen: Open, http response, close. Repeat three times. Takes a while."
for i = 1:3
let
server, servertask = startserver(url=SURL,port=PORT)
status = HTTP.request("GET", "http://$SURL:$PORT").status
println("Status($(i)): $(status)")
@test 200 == status
close(server, servertask)
end
end
@info "Listen: Client side initiates message exchange."
let
server, servertask = startserver(url=SURL,port=PORT)
WebSockets.open(initiatingws, "ws://$SURL:$PORT")
close(server, servertask)
end
@info "Listen: Server side initiates message exchange."
let
server, servertask = startserver(url=SURL,port=PORT)
WebSockets.open(echows, "ws://$SURL:$PORT", subprotocol = SUBPROTOCOL)
close(server, servertask)
end
@info "Listen: Server side initiates message exchange. Close from within server side handler."
let
server, servertask = startserver(url=SURL,port=PORT)
WebSockets.open(echows, "ws://$SURL:$PORT", subprotocol = SUBPROTOCOL_CLOSE)
close(server, servertask)
end
nothing