Search in sources :

Example 1 with StandardPacket

use of de.datasecs.hydra.shared.protocol.packets.StandardPacket in project Hydra by DataSecs.

the class TestServerPacketListener method onStandardPacket.

@PacketHandler
public void onStandardPacket(StandardPacket standardPacket, Session session) {
    Assertions.assertTrue(session.isConnected());
    session.send(new StandardPacket("#Received!"));
}
Also used : StandardPacket(de.datasecs.hydra.shared.protocol.packets.StandardPacket) PacketHandler(de.datasecs.hydra.shared.protocol.packets.listener.PacketHandler)

Example 2 with StandardPacket

use of de.datasecs.hydra.shared.protocol.packets.StandardPacket in project Hydra by DataSecs.

the class TestServerPacketListener method onTestPacket.

@PacketHandler
public void onTestPacket(TestPacket examplePacket, Session session) {
    Assertions.assertTrue(session.isConnected());
    switch(examplePacket.getNumber()) {
        case 0:
            Assertions.assertEquals("Test", examplePacket.getObject().toString());
            break;
    }
    session.send(new StandardPacket("#Received!"));
    session.send(new TestPacket(examplePacket.getNumber(), "test"));
}
Also used : TestPacket(de.datasecs.hydra.shared.TestPacket) StandardPacket(de.datasecs.hydra.shared.protocol.packets.StandardPacket) PacketHandler(de.datasecs.hydra.shared.protocol.packets.listener.PacketHandler)

Aggregations

StandardPacket (de.datasecs.hydra.shared.protocol.packets.StandardPacket)2 PacketHandler (de.datasecs.hydra.shared.protocol.packets.listener.PacketHandler)2 TestPacket (de.datasecs.hydra.shared.TestPacket)1