use of com.tvd12.ezyfoxserver.socket.EzySimpleBytesPackage in project ezyfox-server by youngmonkeys.
the class EzyStreamBytesImpl method execute.
@Override
public void execute(byte[] bytes, EzySession recipient, EzyTransportType transportType) {
EzyStreamingApi streamingApi = server.getStreamingApi();
EzySimpleBytesPackage pack = newPackage(bytes, transportType);
pack.addRecipient(recipient);
try {
streamingApi.response(pack);
} catch (Exception e) {
logger.warn("send {} bytes {}, to client: {} error", bytes.length, recipient.getName(), e);
} finally {
pack.release();
}
}
use of com.tvd12.ezyfoxserver.socket.EzySimpleBytesPackage in project ezyfox-server by youngmonkeys.
the class EzyStreamBytesImpl method newPackage.
protected EzySimpleBytesPackage newPackage(byte[] bytes, EzyTransportType transportType) {
EzySimpleBytesPackage pack = new EzySimpleBytesPackage();
pack.setBytes(bytes);
pack.setTransportType(transportType);
return pack;
}
use of com.tvd12.ezyfoxserver.socket.EzySimpleBytesPackage in project ezyfox-server by youngmonkeys.
the class EzyStreamBytesImpl method execute.
@Override
public void execute(byte[] bytes, Collection<EzySession> recipients, EzyTransportType transportType) {
EzyStreamingApi streamingApi = server.getStreamingApi();
EzySimpleBytesPackage pack = newPackage(bytes, transportType);
pack.addRecipients(recipients);
try {
streamingApi.response(pack);
} catch (Exception e) {
logger.warn("send: {} bytes, to client: {} error", bytes.length, getRecipientsNames(recipients), e);
} finally {
pack.release();
}
}
use of com.tvd12.ezyfoxserver.socket.EzySimpleBytesPackage in project ezyfox-server by youngmonkeys.
the class EzySimpleBytesPackageTest method test.
@Test
public void test() {
EzySimpleBytesPackage pack = new EzySimpleBytesPackage();
pack.setTransportType(EzyTransportType.TCP);
assert pack.getTransportType() == EzyTransportType.TCP;
}
Aggregations