APISonar


org.tomahawk.libtomahawk.network.Msg.JSON

> org > tomahawk > libtomahawk > network > Msg > JSON
org APIs tomahawk APIs libtomahawk APIs network APIs Msg APIs JSON APIs

Example 1
public void testFlagFromTwkPacket() {
        String payload = TomahawkTestData.tstFirstMsg();

        byte[] packet = TomahawkTestData.getTstTwkPacket(payload);

        int flag = Msg.flagFromTwkPacket(packet);
        int otherFlag = Msg.JSON;

        Assert.assertTrue(flag == otherFlag);
    }
Example 2
public static byte[] getTstTwkPacket(String msg) {

        ByteBuffer buf = ByteBuffer.allocate(Msg.headerSize() + msg.length());
        buf.putInt(msg.length());
        buf.put(Msg.JSON);
        buf.put(msg.getBytes());

        return buf.array();
    }