use of com.tvd12.ezyfoxserver.socket.EzySimplePacket in project ezyfox-server by youngmonkeys.
the class EzyAbstractResponseApi method createPacket.
protected EzySimplePacket createPacket(Object bytes, EzyPackage pack) {
EzySimplePacket packet = new EzySimplePacket();
packet.setTransportType(pack.getTransportType());
packet.setData(bytes);
return packet;
}
use of com.tvd12.ezyfoxserver.socket.EzySimplePacket in project ezyfox-server by youngmonkeys.
the class EzyWsResponseApi method createPacket.
@Override
protected EzySimplePacket createPacket(Object bytes, EzyPackage pack) {
EzySimplePacket packet = super.createPacket(bytes, pack);
packet.setBinary(false);
return packet;
}
use of com.tvd12.ezyfoxserver.socket.EzySimplePacket in project ezyfox-server by youngmonkeys.
the class EzyPacketTest method test.
@Test
public void test() {
EzyPacket packet = new EzySimplePacket();
packet.setFragment(new byte[] { 1, 2, 3 });
long start = System.currentTimeMillis();
for (int i = 0; i < 1000000; ++i) {
packet.getSize();
}
long offset = System.currentTimeMillis() - start;
System.out.println(offset);
}
use of com.tvd12.ezyfoxserver.socket.EzySimplePacket in project ezyfox-server by youngmonkeys.
the class EzySocketWriterTest method test.
@Test
public void test() throws Exception {
EzySessionTicketsQueue sessionTicketsQueue = new EzyBlockingSessionTicketsQueue();
EzySocketWriterGroupFetcher writerGroupFetcher = mock(EzySocketWriterGroupFetcher.class);
EzySocketWriterGroup writerGroup = mock(EzySocketWriterGroup.class);
when(writerGroupFetcher.getWriterGroup(any(EzySession.class))).thenReturn(writerGroup);
EzySocketWriter socketWriter = new EzySocketWriter();
socketWriter.setSessionTicketsQueue(sessionTicketsQueue);
socketWriter.setWriterGroupFetcher(writerGroupFetcher);
EzyPacketQueue packetQueue = new EzyNonBlockingPacketQueue();
EzyPacket packet = new EzySimplePacket();
packetQueue.add(packet);
packetQueue.add(packet);
EzyAbstractSession session = spy(EzyAbstractSession.class);
session.setActivated(true);
session.setSessionTicketsQueue(sessionTicketsQueue);
session.setPacketQueue(packetQueue);
sessionTicketsQueue.add(session);
socketWriter.handleEvent();
packet.release();
socketWriter.handleEvent();
socketWriter.destroy();
}
use of com.tvd12.ezyfoxserver.socket.EzySimplePacket 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;
}
Aggregations