use of com.tvd12.ezyfoxserver.setting.EzySimpleWebSocketSetting in project ezyfox-server by youngmonkeys.
the class EzyWebSocketSecureServerCreatorTest method test.
@Test
public void test() throws Exception {
SSLContext sslContext = SSLContext.getDefault();
EzySimpleWebSocketSetting webSocketSetting = new EzySimpleWebSocketSetting();
EzyWebSocketSecureServerCreator creator = new EzyWebSocketSecureServerCreator(sslContext);
creator.setting(webSocketSetting);
creator.create();
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.setting.EzySimpleWebSocketSetting in project ezyfox-server by youngmonkeys.
the class EzySimpleCodecFactoryTest method test.
@Test
public void test() {
EzySimpleSocketSetting socketSetting = new EzySimpleSocketSetting();
socketSetting.setActive(false);
EzySimpleWebSocketSetting webSocketSetting = new EzySimpleWebSocketSetting();
webSocketSetting.setActive(false);
EzyCodecFactory factory = EzySimpleCodecFactory.builder().socketSetting(socketSetting).websocketSetting(webSocketSetting).build();
assert factory.newEncoder(EzyConnectionType.SOCKET) == null;
assert factory.newEncoder(EzyConnectionType.WEBSOCKET) == null;
assert factory.newDecoder(EzyConnectionType.SOCKET) == null;
assert factory.newDecoder(EzyConnectionType.WEBSOCKET) == null;
socketSetting.setActive(true);
socketSetting.setCodecCreator(ExBytesCodecCreator.class.getName());
webSocketSetting.setActive(true);
webSocketSetting.setCodecCreator(ExStringCodecCreator.class.getName());
factory = EzySimpleCodecFactory.builder().socketSetting(socketSetting).websocketSetting(webSocketSetting).build();
assert factory.newEncoder(EzyConnectionType.SOCKET) != null;
assert factory.newEncoder(EzyConnectionType.WEBSOCKET) != null;
assert factory.newDecoder(EzyConnectionType.SOCKET) != null;
assert factory.newDecoder(EzyConnectionType.WEBSOCKET) != null;
}
use of com.tvd12.ezyfoxserver.setting.EzySimpleWebSocketSetting in project ezyfox-server by youngmonkeys.
the class EzyWebSocketSettingBuilderTest method test.
@Test
public void test() {
// given
EzyWebSocketSettingBuilder sut = new EzyWebSocketSettingBuilder().managementEnable(true);
// when
EzySimpleWebSocketSetting setting = sut.build();
// then
Asserts.assertEquals(true, setting.isManagementEnable());
}
Aggregations