package org.lte.project.gtp.user.test.message;

import org.apache.mina.core.buffer.IoBuffer;
import org.junit.Assert;
import org.junit.Test;
import org.lte.project.gtp.core.message.DecodingException;
import org.lte.project.gtp.user.message.GTPuMessage;

/**
 * @author Calin Cerchez [calin.cerchez@gmail.com]
 */
public class GTPuMessageTest {

    @Test
    public void testEchoRequestMessage() throws DecodingException {
        GTPuMessage echoRequest1 = new GTPuMessage(GTPuMessage.ECHO_REQUEST, 1);

        IoBuffer buffer = IoBuffer.allocate(echoRequest1.getLength());

        echoRequest1.encode(buffer);

        buffer.flip();

        GTPuMessage echoRequest2 = GTPuMessage.decode(buffer);

        Assert.assertEquals(echoRequest1, echoRequest2);
    }
}
