Search in sources :

Example 1 with EzyWebSocketServerBootstrap

use of com.tvd12.ezyfoxserver.nio.EzyWebSocketServerBootstrap 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);
}
Also used : EzySimpleServer(com.tvd12.ezyfoxserver.EzySimpleServer) EzyWebSocketServerBootstrap(com.tvd12.ezyfoxserver.nio.EzyWebSocketServerBootstrap) EzyServerContext(com.tvd12.ezyfoxserver.context.EzyServerContext) SSLContext(javax.net.ssl.SSLContext) EzySimpleSettings(com.tvd12.ezyfoxserver.setting.EzySimpleSettings) EzyWebSocketServerCreator(com.tvd12.ezyfoxserver.nio.builder.impl.EzyWebSocketServerCreator) Test(org.testng.annotations.Test)

Aggregations

EzySimpleServer (com.tvd12.ezyfoxserver.EzySimpleServer)1 EzyServerContext (com.tvd12.ezyfoxserver.context.EzyServerContext)1 EzyWebSocketServerBootstrap (com.tvd12.ezyfoxserver.nio.EzyWebSocketServerBootstrap)1 EzyWebSocketServerCreator (com.tvd12.ezyfoxserver.nio.builder.impl.EzyWebSocketServerCreator)1 EzySimpleSettings (com.tvd12.ezyfoxserver.setting.EzySimpleSettings)1 SSLContext (javax.net.ssl.SSLContext)1 Test (org.testng.annotations.Test)1