Search in sources :

Example 1 with EzyBytesPackage

use of com.tvd12.ezyfoxserver.response.EzyBytesPackage in project ezyfox-server by youngmonkeys.

the class EzyAbstractStreamingApi method createPacket.

private EzyPacket createPacket(byte[] bytes, EzyBytesPackage pack) {
    EzySimplePacket packet = new EzySimplePacket();
    packet.setTransportType(pack.getTransportType());
    packet.setData(bytes);
    return packet;
}
Also used : EzySimplePacket(com.tvd12.ezyfoxserver.socket.EzySimplePacket)

Example 2 with EzyBytesPackage

use of com.tvd12.ezyfoxserver.response.EzyBytesPackage in project ezyfox-server by youngmonkeys.

the class EzyAbstractStreamingApi method response.

@Override
public void response(EzyBytesPackage pack) throws Exception {
    EzyConstant connectionType = getConnectionType();
    Collection<EzySession> recipients = pack.getRecipients(connectionType);
    if (recipients.isEmpty()) {
        return;
    }
    byte[] bytes = pack.getBytes();
    for (EzySession session : recipients) {
        session.send(createPacket(bytes, pack));
    }
}
Also used : EzyConstant(com.tvd12.ezyfox.constant.EzyConstant) EzySession(com.tvd12.ezyfoxserver.entity.EzySession)

Example 3 with EzyBytesPackage

use of com.tvd12.ezyfoxserver.response.EzyBytesPackage in project ezyfox-server by youngmonkeys.

the class EzyProxyStreamingApiTest method test.

@Test
public void test() throws Exception {
    EzyProxyStreamingApi api = new EzyProxyStreamingApi();
    EzyBytesPackage pack = mock(EzyBytesPackage.class);
    api.response(pack);
}
Also used : EzyProxyStreamingApi(com.tvd12.ezyfoxserver.api.EzyProxyStreamingApi) EzyBytesPackage(com.tvd12.ezyfoxserver.response.EzyBytesPackage) BaseTest(com.tvd12.test.base.BaseTest) Test(org.testng.annotations.Test)

Aggregations

EzyConstant (com.tvd12.ezyfox.constant.EzyConstant)1 EzyProxyStreamingApi (com.tvd12.ezyfoxserver.api.EzyProxyStreamingApi)1 EzySession (com.tvd12.ezyfoxserver.entity.EzySession)1 EzyBytesPackage (com.tvd12.ezyfoxserver.response.EzyBytesPackage)1 EzySimplePacket (com.tvd12.ezyfoxserver.socket.EzySimplePacket)1 BaseTest (com.tvd12.test.base.BaseTest)1 Test (org.testng.annotations.Test)1