Polish DefaultHandshakeHandler

After this change the DefaultHandshakeHandler delegates to a
server-specific RequestUpgradeStrategy to update the HTTP response for
the handshake request and to begin the WebSocket interaction.

The DefaultHandshakeHandler however still retains the initial
validation of the WebSocket handshake including negotation of origin,
sub-protocol, etc. This allows sub-classes to override various
aspects of the negotiation independant of the WebSocket engine.
This commit is contained in:
Rossen Stoyanchev
2013-08-16 21:45:27 -04:00
parent 48996cf572
commit e5406283c5
6 changed files with 91 additions and 120 deletions

View File

@@ -215,6 +215,17 @@ public class AbstractSockJsSessionTests extends BaseAbstractSockJsSessionTests<T
assertClosed();
}
@Test
public void tryCloseWithWebSocketHandlerExceptions() throws Exception {
this.session.delegateConnectionEstablished();
this.session.setActive(true);
this.session.tryCloseWithSockJsTransportError(new Exception(), CloseStatus.BAD_DATA);
assertEquals(CloseStatus.BAD_DATA, this.session.getCloseStatus());
assertClosed();
}
@Test
public void writeFrame() throws Exception {
this.session.writeFrame(SockJsFrame.openFrame());