use of com.tvd12.ezyfoxserver.nio.EzyNioServerBootstrap in project ezyfox-server by youngmonkeys.
the class EzyNioServerBootstrapTest method startSocketServerBootstrapNotActive.
@Test
public void startSocketServerBootstrapNotActive() {
// given
EzySimpleServer server = new EzySimpleServer();
EzySimpleSettings settings = new EzySimpleSettings();
settings.getSocket().setActive(false);
server.setSettings(settings);
EzyServerContext context = mock(EzyServerContext.class);
when(context.getServer()).thenReturn(server);
EzyNioServerBootstrap sut = new EzyNioServerBootstrap();
sut.setContext(context);
// when
MethodUtil.invokeMethod("startSocketServerBootstrap", sut);
// then
Asserts.assertNull(FieldUtil.getFieldValue(sut, "socketServerBootstrap"));
}
use of com.tvd12.ezyfoxserver.nio.EzyNioServerBootstrap in project ezyfox-server by youngmonkeys.
the class EzyNioServerBootstrapBuilderImpl method newServerBootstrap.
@Override
protected EzyServerBootstrap newServerBootstrap() {
ExecutorService statsThreadPool = newStatsThreadPool();
EzyCodecFactory codecFactory = newCodecFactory();
EzyStreamingApi streamingApi = newStreamingApi();
EzyResponseApi responseApi = newResponseApi(codecFactory);
EzySocketStreamQueue streamQueue = newStreamQueue();
EzySessionTicketsQueue socketSessionTicketsQueue = newSocketSessionTicketsQueue();
EzySessionTicketsQueue websocketSessionTicketsQueue = newWebSocketSessionTicketsQueue();
EzySocketDisconnectionQueue socketDisconnectionQueue = newSocketDisconnectionQueue();
EzySessionTicketsRequestQueues sessionTicketsRequestQueues = newSessionTicketsRequestQueues();
EzyHandlerGroupBuilderFactory handlerGroupBuilderFactory = newHandlerGroupBuilderFactory(statsThreadPool, codecFactory, streamQueue, socketDisconnectionQueue, socketSessionTicketsQueue, websocketSessionTicketsQueue, sessionTicketsRequestQueues);
EzyHandlerGroupManager handlerGroupManager = newHandlerGroupManager(handlerGroupBuilderFactory);
EzySocketDataReceiver socketDataReceiver = newSocketDataReceiver(handlerGroupManager);
EzyNioServerBootstrap bootstrap = new EzyNioServerBootstrap();
bootstrap.setResponseApi(responseApi);
bootstrap.setStreamingApi(streamingApi);
bootstrap.setStreamQueue(streamQueue);
bootstrap.setSocketDataReceiver(socketDataReceiver);
bootstrap.setHandlerGroupManager(handlerGroupManager);
bootstrap.setSocketDisconnectionQueue(socketDisconnectionQueue);
bootstrap.setSocketSessionTicketsQueue(socketSessionTicketsQueue);
bootstrap.setWebsocketSessionTicketsQueue(websocketSessionTicketsQueue);
bootstrap.setSocketSessionTicketsRequestQueues(sessionTicketsRequestQueues);
bootstrap.setSslContext(newSslContext(getWebsocketSetting().getSslConfig()));
return bootstrap;
}
Aggregations