AbstractClientSockJsSession.close propagates IOException from disconnect

Issue: SPR-16415

(cherry picked from commit cf100d4)
This commit is contained in:
Juergen Hoeller
2018-01-25 12:24:46 +01:00
parent 09cb7f4c31
commit a041769799
2 changed files with 35 additions and 19 deletions

View File

@@ -129,8 +129,10 @@ public class ClientSockJsSessionTests {
@Test
public void handleFrameMessageWithWebSocketHandlerException() throws Exception {
this.session.handleFrame(SockJsFrame.openFrame().getContent());
willThrow(new IllegalStateException("Fake error")).given(this.handler).handleMessage(this.session, new TextMessage("foo"));
willThrow(new IllegalStateException("Fake error")).given(this.handler).handleMessage(this.session, new TextMessage("bar"));
willThrow(new IllegalStateException("Fake error")).given(this.handler)
.handleMessage(this.session, new TextMessage("foo"));
willThrow(new IllegalStateException("Fake error")).given(this.handler)
.handleMessage(this.session, new TextMessage("bar"));
this.session.handleFrame(SockJsFrame.messageFrame(CODEC, "foo", "bar").getContent());
assertThat(this.session.isOpen(), equalTo(true));
verify(this.handler).afterConnectionEstablished(this.session);