Provide access to CloseStatus in WebSocketSession

Closes gh-22079
This commit is contained in:
Rossen Stoyanchev
2020-05-14 11:20:12 +01:00
parent 6403a9f10e
commit de378599d3
8 changed files with 98 additions and 26 deletions

View File

@@ -147,9 +147,11 @@ class WebSocketIntegrationTests extends AbstractWebSocketIntegrationTests {
void sessionClosing(WebSocketClient client, HttpServer server, Class<?> serverConfigClass) throws Exception {
startServer(client, server, serverConfigClass);
MonoProcessor<CloseStatus> statusProcessor = MonoProcessor.create();
this.client.execute(getUrl("/close"),
session -> {
logger.debug("Starting..");
session.closeStatus().subscribe(statusProcessor);
return session.receive()
.doOnNext(s -> logger.debug("inbound " + s))
.then()
@@ -158,6 +160,8 @@ class WebSocketIntegrationTests extends AbstractWebSocketIntegrationTests {
);
})
.block(TIMEOUT);
assertThat(statusProcessor.block()).isEqualTo(CloseStatus.GOING_AWAY);
}
@ParameterizedWebSocketTest