Search in sources :

Example 1 with EzyStreamBytesImpl

use of com.tvd12.ezyfoxserver.command.impl.EzyStreamBytesImpl in project ezyfox-server by youngmonkeys.

the class EzyStreamBytesImplTest method exceptionCaseTest.

@Test
public void exceptionCaseTest() throws Exception {
    EzySimpleSettings settings = new EzySimpleSettings();
    settings.setDebug(true);
    EzyStreamingApi streamingApi = spy(EzyStreamingApi.class);
    doThrow(new IllegalArgumentException()).when(streamingApi).response(any(EzyBytesPackage.class));
    EzySimpleServer server = new EzySimpleServer();
    server.setStreamingApi(streamingApi);
    server.setSettings(settings);
    EzyStreamBytesImpl cmd = new EzyStreamBytesImpl(server);
    EzySession recipient = spy(EzyAbstractSession.class);
    cmd.execute(new byte[] { 1, 2, 3 }, recipient);
    cmd.execute(new byte[] { 1, 2, 3 }, Lists.newArrayList(recipient));
}
Also used : EzySimpleServer(com.tvd12.ezyfoxserver.EzySimpleServer) EzyStreamingApi(com.tvd12.ezyfoxserver.api.EzyStreamingApi) EzySimpleSettings(com.tvd12.ezyfoxserver.setting.EzySimpleSettings) EzyBytesPackage(com.tvd12.ezyfoxserver.response.EzyBytesPackage) EzyStreamBytesImpl(com.tvd12.ezyfoxserver.command.impl.EzyStreamBytesImpl) EzySession(com.tvd12.ezyfoxserver.entity.EzySession) Test(org.testng.annotations.Test)

Example 2 with EzyStreamBytesImpl

use of com.tvd12.ezyfoxserver.command.impl.EzyStreamBytesImpl in project ezyfox-server by youngmonkeys.

the class EzyStreamBytesImplTest method normalCaseTest.

@Test
public void normalCaseTest() {
    EzySimpleSettings settings = new EzySimpleSettings();
    settings.setDebug(true);
    EzyStreamingApi streamingApi = spy(EzyAbstractStreamingApi.class);
    EzySimpleServer server = new EzySimpleServer();
    server.setStreamingApi(streamingApi);
    server.setSettings(settings);
    EzyStreamBytesImpl cmd = new EzyStreamBytesImpl(server);
    EzySession recipient = spy(EzyAbstractSession.class);
    cmd.execute(new byte[] { 1, 2, 3 }, recipient);
    cmd.execute(new byte[] { 1, 2, 3 }, Lists.newArrayList(recipient));
}
Also used : EzySimpleServer(com.tvd12.ezyfoxserver.EzySimpleServer) EzyStreamingApi(com.tvd12.ezyfoxserver.api.EzyStreamingApi) EzySimpleSettings(com.tvd12.ezyfoxserver.setting.EzySimpleSettings) EzyStreamBytesImpl(com.tvd12.ezyfoxserver.command.impl.EzyStreamBytesImpl) EzySession(com.tvd12.ezyfoxserver.entity.EzySession) Test(org.testng.annotations.Test)

Aggregations

EzySimpleServer (com.tvd12.ezyfoxserver.EzySimpleServer)2 EzyStreamingApi (com.tvd12.ezyfoxserver.api.EzyStreamingApi)2 EzyStreamBytesImpl (com.tvd12.ezyfoxserver.command.impl.EzyStreamBytesImpl)2 EzySession (com.tvd12.ezyfoxserver.entity.EzySession)2 EzySimpleSettings (com.tvd12.ezyfoxserver.setting.EzySimpleSettings)2 Test (org.testng.annotations.Test)2 EzyBytesPackage (com.tvd12.ezyfoxserver.response.EzyBytesPackage)1