@Test(groups = {"functional.encode"}) public void testEncode() throws IOException, EncodeException { byte[] expected = this.getData(); Invoke invoke = TcapFactory.createComponentInvoke(); invoke.setInvokeId(12l); OperationCode oc = TcapFactory.createOperationCode(); oc.setLocalOperationCode(59L); invoke.setOperationCode(oc); Parameter p1 = TcapFactory.createParameter(); p1.setTagClass(Tag.CLASS_UNIVERSAL); p1.setTag(Tag.STRING_OCTET); p1.setData(new byte[] {0x0F}); Parameter p2 = TcapFactory.createParameter(); p2.setTagClass(Tag.CLASS_UNIVERSAL); p2.setTag(Tag.STRING_OCTET); p2.setData( new byte[] { (byte) 0xaa, (byte) 0x98, (byte) 0xac, (byte) 0xa6, 0x5a, (byte) 0xcd, 0x62, 0x36, 0x19, 0x0e, 0x37, (byte) 0xcb, (byte) 0xe5, 0x72, (byte) 0xb9, 0x11 }); Parameter pm = TcapFactory.createParameter(); pm.setTagClass(Tag.CLASS_UNIVERSAL); pm.setTag(Tag.SEQUENCE); pm.setParameters(new Parameter[] {p1, p2}); invoke.setParameter(pm); AsnOutputStream asnos = new AsnOutputStream(); invoke.encode(asnos); byte[] encodedData = asnos.toByteArray(); assertTrue(Arrays.equals(expected, encodedData)); expected = this.getDataFull(); invoke = TcapFactory.createComponentInvoke(); invoke.setInvokeId(-5L); invoke.setLinkedId(2L); oc = TcapFactory.createOperationCode(); oc.setGlobalOperationCode(new long[] {1, 0, 0, 1}); invoke.setOperationCode(oc); pm = TcapFactory.createParameter(); pm.setTagClass(Tag.CLASS_UNIVERSAL); pm.setTag(Tag.STRING_OCTET); pm.setData(new byte[] {11, 22, 33}); invoke.setParameter(pm); asnos = new AsnOutputStream(); invoke.encode(asnos); encodedData = asnos.toByteArray(); assertTrue(Arrays.equals(expected, encodedData)); }