Add configurability for underlying WebSocket engine

Issue: SPR-10844
This commit is contained in:
Rossen Stoyanchev
2013-08-22 20:35:03 -04:00
parent ccaa101252
commit a5143057ce
19 changed files with 222 additions and 72 deletions

View File

@@ -34,6 +34,8 @@ public class StubSockJsServiceConfig implements SockJsServiceConfig {
private SockJsMessageCodec messageCodec = new Jackson2SockJsMessageCodec();
private int httpMessageCacheSize = 100;
@Override
public int getStreamBytesLimit() {
@@ -71,4 +73,12 @@ public class StubSockJsServiceConfig implements SockJsServiceConfig {
this.messageCodec = messageCodec;
}
public int getHttpMessageCacheSize() {
return this.httpMessageCacheSize;
}
public void setHttpMessageCacheSize(int httpMessageCacheSize) {
this.httpMessageCacheSize = httpMessageCacheSize;
}
}

View File

@@ -62,7 +62,7 @@ public class WebSocketServerSockJsSessionTests extends BaseAbstractSockJsSession
public void isActive() throws Exception {
assertFalse(this.session.isActive());
this.session.afterSessionInitialized(this.webSocketSession);
this.session.initializeDelegateSession(this.webSocketSession);
assertTrue(this.session.isActive());
this.webSocketSession.setOpen(false);
@@ -72,7 +72,7 @@ public class WebSocketServerSockJsSessionTests extends BaseAbstractSockJsSession
@Test
public void afterSessionInitialized() throws Exception {
this.session.afterSessionInitialized(this.webSocketSession);
this.session.initializeDelegateSession(this.webSocketSession);
assertEquals("Open frame not sent",
Collections.singletonList(new TextMessage("o")), this.webSocketSession.getSentMessages());
@@ -111,7 +111,7 @@ public class WebSocketServerSockJsSessionTests extends BaseAbstractSockJsSession
@Test
public void sendMessageInternal() throws Exception {
this.session.afterSessionInitialized(this.webSocketSession);
this.session.initializeDelegateSession(this.webSocketSession);
this.session.sendMessageInternal("x");
assertEquals(Arrays.asList(new TextMessage("o"), new TextMessage("a[\"x\"]")),
@@ -123,7 +123,7 @@ public class WebSocketServerSockJsSessionTests extends BaseAbstractSockJsSession
@Test
public void disconnect() throws Exception {
this.session.afterSessionInitialized(this.webSocketSession);
this.session.initializeDelegateSession(this.webSocketSession);
this.session.close(CloseStatus.NOT_ACCEPTABLE);
assertEquals(CloseStatus.NOT_ACCEPTABLE, this.webSocketSession.getCloseStatus());