Search in sources :

Example 6 with EzyNonBlockingPacketQueue

use of com.tvd12.ezyfoxserver.socket.EzyNonBlockingPacketQueue in project ezyfox-server by youngmonkeys.

the class EzySocketWriterTest method processSessionTicketsQueue0ExceptionCase.

@Test
public void processSessionTicketsQueue0ExceptionCase() {
    EzySessionTicketsQueue sessionTicketsQueue = new EzyBlockingSessionTicketsQueue();
    EzySocketWriterGroupFetcher writerGroupFetcher = mock(EzySocketWriterGroupFetcher.class);
    when(writerGroupFetcher.getWriterGroup(any(EzySession.class))).thenThrow(new IllegalArgumentException());
    EzySocketWriter socketWriter = new EzySocketWriter();
    socketWriter.setSessionTicketsQueue(sessionTicketsQueue);
    socketWriter.setWriterGroupFetcher(writerGroupFetcher);
    EzyPacketQueue packetQueue = new EzyNonBlockingPacketQueue();
    EzyPacket packet = new EzySimplePacket();
    packetQueue.add(packet);
    EzyAbstractSession session = spy(EzyAbstractSession.class);
    session.setActivated(true);
    session.setSessionTicketsQueue(sessionTicketsQueue);
    session.setPacketQueue(packetQueue);
    sessionTicketsQueue.add(session);
    socketWriter.handleEvent();
}
Also used : EzyAbstractSession(com.tvd12.ezyfoxserver.entity.EzyAbstractSession) EzySession(com.tvd12.ezyfoxserver.entity.EzySession) BaseTest(com.tvd12.test.base.BaseTest) Test(org.testng.annotations.Test)

Aggregations

Test (org.testng.annotations.Test)5 BaseTest (com.tvd12.test.base.BaseTest)4 EzyAbstractSession (com.tvd12.ezyfoxserver.entity.EzyAbstractSession)3 EzySession (com.tvd12.ezyfoxserver.entity.EzySession)3 EzyNonBlockingPacketQueue (com.tvd12.ezyfoxserver.socket.EzyNonBlockingPacketQueue)2 EzyRequestFrameSecond (com.tvd12.ezyfoxserver.statistics.EzyRequestFrameSecond)2 EzyDroppedPackets (com.tvd12.ezyfoxserver.entity.EzyDroppedPackets)1 EzyImmediateDeliver (com.tvd12.ezyfoxserver.entity.EzyImmediateDeliver)1 EzyNonBlockingRequestQueue (com.tvd12.ezyfoxserver.socket.EzyNonBlockingRequestQueue)1 EzySimplePacket (com.tvd12.ezyfoxserver.socket.EzySimplePacket)1 BaseCoreTest (com.tvd12.ezyfoxserver.testing.BaseCoreTest)1 MyTestSession (com.tvd12.ezyfoxserver.testing.MyTestSession)1 InetSocketAddress (java.net.InetSocketAddress)1