use of com.tvd12.ezyfoxserver.nio.builder.impl.EzyWebSocketServerCreator in project ezyfox-server by youngmonkeys.
the class EzyWebSocketServerCreatorTest method createManagementTest.
@Test
public void createManagementTest() {
// given
EzyWebSocketServerCreator creator = new EzyWebSocketServerCreator();
EzySimpleWebSocketSetting webSocketSetting = new EzySimpleWebSocketSetting();
webSocketSetting.setManagementEnable(true);
creator.setting(webSocketSetting);
// when
creator.create();
// then
EzyWsHandler wsHandler = MethodInvoker.create().object(creator).method("newWsHandler").invoke(EzyWsHandler.class);
WebSocketCreator webSocketCreator = MethodInvoker.create().object(creator).method("newWebSocketCreator").param(EzyWsHandler.class, wsHandler).invoke(WebSocketCreator.class);
webSocketCreator.createWebSocket(null, null);
}
use of com.tvd12.ezyfoxserver.nio.builder.impl.EzyWebSocketServerCreator in project ezyfox-server by youngmonkeys.
the class EzyWebSocketServerBootstrapTest method newSocketServerCreatorWithSSL.
@Test
public void newSocketServerCreatorWithSSL() {
// given
SSLContext sslContext = mock(SSLContext.class);
EzyServerContext serverContext = mock(EzyServerContext.class);
EzySimpleServer server = new EzySimpleServer();
when(serverContext.getServer()).thenReturn(server);
EzySimpleSettings settings = new EzySimpleSettings();
settings.getWebsocket().setSslActive(true);
server.setSettings(settings);
EzyWebSocketServerBootstrap sut = EzyWebSocketServerBootstrap.builder().sslContext(sslContext).serverContext(serverContext).build();
// when
EzyWebSocketServerCreator creator = MethodUtil.invokeMethod("newSocketServerCreator", sut);
// then
Asserts.assertNotNull(creator);
}
Aggregations