use of com.corundumstudio.socketio.protocol.Packet in project netty-socketio by mrniko.
the class DecoderMessagePacketTest method testDecode.
@Test
public void testDecode() throws IOException {
Packet packet = decoder.decodePacket("3:::woot", null);
Assert.assertEquals(PacketType.MESSAGE, packet.getType());
Assert.assertEquals("woot", packet.getData());
}
use of com.corundumstudio.socketio.protocol.Packet in project netty-socketio by mrniko.
the class EncoderAckPacketTest method testEncode.
@Test
public void testEncode() throws IOException {
Packet packet = new Packet(PacketType.ACK);
packet.setAckId(140L);
ByteBuf result = Unpooled.buffer();
// encoder.encodePacket(packet, result);
Assert.assertEquals("6:::140", result.toString(CharsetUtil.UTF_8));
}
use of com.corundumstudio.socketio.protocol.Packet in project netty-socketio by mrniko.
the class EncoderConnectionPacketTest method testEncodeDisconnection.
@Test
public void testEncodeDisconnection() throws IOException {
Packet packet = new Packet(PacketType.DISCONNECT);
packet.setNsp("/woot");
ByteBuf result = Unpooled.buffer();
// encoder.encodePacket(packet, result);
Assert.assertEquals("0::/woot", result.toString(CharsetUtil.UTF_8));
}
use of com.corundumstudio.socketio.protocol.Packet in project netty-socketio by mrniko.
the class EncoderMessagePacketTest method testEncode.
@Test
public void testEncode() throws IOException {
Packet packet = new Packet(PacketType.MESSAGE);
packet.setData("woot");
ByteBuf result = Unpooled.buffer();
// encoder.encodePacket(packet, result);
Assert.assertEquals("3:::woot", result.toString(CharsetUtil.UTF_8));
}
use of com.corundumstudio.socketio.protocol.Packet in project netty-socketio by mrniko.
the class EncoderMessagePacketTest method testEncodeWithIdAndEndpoint.
@Test
public void testEncodeWithIdAndEndpoint() throws IOException {
Packet packet = new Packet(PacketType.MESSAGE);
// packet.setId(5L);
// packet.setAck(true);
packet.setNsp("/tobi");
ByteBuf result = Unpooled.buffer();
// encoder.encodePacket(packet, result);
Assert.assertEquals("3:5:/tobi", result.toString(CharsetUtil.UTF_8));
}
Aggregations