use of com.tvd12.ezyfoxserver.command.EzyResponse in project ezyfox-server by youngmonkeys.
the class EzyAppSendResponseImpl method execute.
@Override
public void execute(EzyData data, EzySession recipient, boolean encrypted, EzyTransportType transportType) {
EzyResponse response = newResponse(data);
serverContext.send(response, recipient, encrypted, transportType);
}
use of com.tvd12.ezyfoxserver.command.EzyResponse in project ezyfox-server by youngmonkeys.
the class EzyCloseSessionImpl method doSendToClients.
protected void doSendToClients(EzySession session, EzyConstant reason) {
EzyResponse response = newResponse(reason);
context.sendNow(response, session);
}
use of com.tvd12.ezyfoxserver.command.EzyResponse in project ezyfox-server by youngmonkeys.
the class EzySendResponseImplTest method responseMultiSuccessCase.
@Test
public void responseMultiSuccessCase() throws Exception {
// when
EzySimpleSettings settings = new EzySimpleSettings();
settings.setDebug(true);
EzyResponseApi responseApi = mock(EzyResponseApi.class);
EzySimpleServer server = new EzySimpleServer();
server.setResponseApi(responseApi);
server.setSettings(settings);
EzySendResponseImpl cmd = new EzySendResponseImpl(server);
EzyResponse response = new EzySimpleResponse(EzyCommand.APP_REQUEST);
EzySession recipient = spy(EzyAbstractSession.class);
List<EzySession> recipients = Collections.singletonList(recipient);
// when
cmd.execute(response, recipients, false, false, EzyTransportType.TCP);
// then
verify(responseApi, times(1)).response(any(EzyPackage.class), anyBoolean());
}
use of com.tvd12.ezyfoxserver.command.EzyResponse in project ezyfox-server by youngmonkeys.
the class EzySendResponseImplTest method responseMultiSuccessCaseButIsPong.
@Test
public void responseMultiSuccessCaseButIsPong() throws Exception {
// when
EzySimpleSettings settings = new EzySimpleSettings();
settings.setDebug(true);
EzyResponseApi responseApi = mock(EzyResponseApi.class);
EzySimpleServer server = new EzySimpleServer();
server.setResponseApi(responseApi);
server.setSettings(settings);
EzySendResponseImpl cmd = new EzySendResponseImpl(server);
EzyResponse response = new EzySimpleResponse(EzyCommand.PONG);
EzySession recipient = spy(EzyAbstractSession.class);
List<EzySession> recipients = Collections.singletonList(recipient);
// when
cmd.execute(response, recipients, false, false, EzyTransportType.TCP);
// then
verify(responseApi, times(1)).response(any(EzyPackage.class), anyBoolean());
}
use of com.tvd12.ezyfoxserver.command.EzyResponse in project ezyfox-server by youngmonkeys.
the class EzySendResponseImplTest method responseOneSuccessCaseTest.
@Test
public void responseOneSuccessCaseTest() {
EzySimpleSettings settings = new EzySimpleSettings();
settings.setDebug(true);
EzyResponseApi responseApi = spy(EzyAbstractResponseApi.class);
EzySimpleServer server = new EzySimpleServer();
server.setResponseApi(responseApi);
server.setSettings(settings);
EzySendResponseImpl cmd = new EzySendResponseImpl(server);
EzyResponse response = new EzySimpleResponse(EzyCommand.APP_REQUEST);
EzySession recipient = spy(EzyAbstractSession.class);
cmd.execute(response, recipient, false, false, EzyTransportType.TCP);
}
Aggregations