use of org.springframework.web.socket.CloseStatus in project spring-framework by spring-projects.
the class ClientSockJsSessionTests method closeWithStatusOutOfRange.
@Test
public void closeWithStatusOutOfRange() throws Exception {
this.session.handleFrame(SockJsFrame.openFrame().getContent());
this.thrown.expect(IllegalArgumentException.class);
this.thrown.expectMessage("Invalid close status");
this.session.close(new CloseStatus(2999, "reason"));
}
use of org.springframework.web.socket.CloseStatus in project spring-framework by spring-projects.
the class ClientSockJsSessionTests method closeWithStatus.
@Test
public void closeWithStatus() throws Exception {
this.session.handleFrame(SockJsFrame.openFrame().getContent());
this.session.close(new CloseStatus(3000, "reason"));
assertThat(this.session.disconnectStatus, equalTo(new CloseStatus(3000, "reason")));
}
use of org.springframework.web.socket.CloseStatus in project spring-framework by spring-projects.
the class SockJsSessionTests method closeWithWriteFrameExceptions.
@Test
public void closeWithWriteFrameExceptions() throws Exception {
this.session.setExceptionOnWrite(new IOException());
this.session.delegateConnectionEstablished();
this.session.setActive(true);
this.session.close();
assertEquals(new CloseStatus(3000, "Go away!"), this.session.getCloseStatus());
assertClosed();
}
Aggregations