Search in sources :

Example 6 with Packet

use of com.corundumstudio.socketio.protocol.Packet in project netty-socketio by mrniko.

the class DecoderConnectionPacketTest method testDecodeWithQueryString.

@Test
public void testDecodeWithQueryString() throws IOException {
    Packet packet = decoder.decodePacket("1::/test:?test=1", null);
    Assert.assertEquals(PacketType.CONNECT, packet.getType());
    Assert.assertEquals("/test", packet.getNsp());
//        Assert.assertEquals("?test=1", packet.getQs());
}
Also used : Packet(com.corundumstudio.socketio.protocol.Packet) Test(org.junit.Test)

Example 7 with Packet

use of com.corundumstudio.socketio.protocol.Packet in project netty-socketio by mrniko.

the class DecoderConnectionPacketTest method testDecode.

@Test
public void testDecode() throws IOException {
    Packet packet = decoder.decodePacket("1::/tobi", null);
    Assert.assertEquals(PacketType.CONNECT, packet.getType());
    Assert.assertEquals("/tobi", packet.getNsp());
}
Also used : Packet(com.corundumstudio.socketio.protocol.Packet) Test(org.junit.Test)

Example 8 with Packet

use of com.corundumstudio.socketio.protocol.Packet in project netty-socketio by mrniko.

the class DecoderConnectionPacketTest method testDecodeDisconnection.

@Test
public void testDecodeDisconnection() throws IOException {
    Packet packet = decoder.decodePacket("0::/woot", null);
    Assert.assertEquals(PacketType.DISCONNECT, packet.getType());
    Assert.assertEquals("/woot", packet.getNsp());
}
Also used : Packet(com.corundumstudio.socketio.protocol.Packet) Test(org.junit.Test)

Example 9 with Packet

use of com.corundumstudio.socketio.protocol.Packet in project netty-socketio by mrniko.

the class DecoderEventPacketTest method testDecode.

@Test
public void testDecode() throws IOException {
    Packet packet = decoder.decodePacket("5:::{\"name\":\"woot\"}", null);
    Assert.assertEquals(PacketType.EVENT, packet.getType());
    Assert.assertEquals("woot", packet.getName());
}
Also used : Packet(com.corundumstudio.socketio.protocol.Packet) Test(org.junit.Test)

Example 10 with Packet

use of com.corundumstudio.socketio.protocol.Packet in project netty-socketio by mrniko.

the class DecoderEventPacketTest method testDecodeWithMessageIdAndAck.

@Test
public void testDecodeWithMessageIdAndAck() throws IOException {
    Packet packet = decoder.decodePacket("5:1+::{\"name\":\"tobi\"}", null);
    Assert.assertEquals(PacketType.EVENT, packet.getType());
    //        Assert.assertEquals(1, (long)packet.getId());
    //        Assert.assertEquals(Packet.ACK_DATA, packet.getAck());
    Assert.assertEquals("tobi", packet.getName());
}
Also used : Packet(com.corundumstudio.socketio.protocol.Packet) Test(org.junit.Test)

Aggregations

Packet (com.corundumstudio.socketio.protocol.Packet)39 Test (org.junit.Test)27 ByteBuf (io.netty.buffer.ByteBuf)15 Namespace (com.corundumstudio.socketio.namespace.Namespace)2 AuthPacket (com.corundumstudio.socketio.protocol.AuthPacket)2 HandshakeData (com.corundumstudio.socketio.HandshakeData)1 SocketIOClient (com.corundumstudio.socketio.SocketIOClient)1 Transport (com.corundumstudio.socketio.Transport)1 HttpErrorMessage (com.corundumstudio.socketio.messages.HttpErrorMessage)1 JacksonJsonSupport (com.corundumstudio.socketio.protocol.JacksonJsonSupport)1 PacketDecoder (com.corundumstudio.socketio.protocol.PacketDecoder)1 ConnectMessage (com.corundumstudio.socketio.store.pubsub.ConnectMessage)1 NamespaceClient (com.corundumstudio.socketio.transport.NamespaceClient)1 Channel (io.netty.channel.Channel)1 ChannelFuture (io.netty.channel.ChannelFuture)1 DefaultHttpResponse (io.netty.handler.codec.http.DefaultHttpResponse)1 HttpResponse (io.netty.handler.codec.http.HttpResponse)1 BinaryWebSocketFrame (io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame)1 TextWebSocketFrame (io.netty.handler.codec.http.websocketx.TextWebSocketFrame)1 WebSocketFrame (io.netty.handler.codec.http.websocketx.WebSocketFrame)1