@Test
public void testEncodeSmallBuffer() throws Exception
{
DiameterAnswer answer = new DiameterAnswer();
answer.setCommand(Sh.UDA);
AVPList l = new AVPList();
answer.setAVPList(l);
answer.setResultCode(Common.DIAMETER_SUCCESS);
answer.setEndToEndId(33);
answer.setHopByHopId(51648);
l.add(Common.DIAMETER_SUCCESS.getAVP());
l.add(new AVP<String>(Common.ORIGIN_HOST, "cipango.org"));
l.add(new AVP<InetAddress>(Common.HOST_IP_ADDRESS, InetAddress.getLocalHost()));
l.add(new AVP<Integer>(Common.FIRMWARE_REVISION, 2));
l.add(new AVP<byte[]>(Sh.USER_DATA, "<shData>dasaiTag<shData>".getBytes()));
for (int i = 24; i < 256; i++)
{
Buffer buffer = new ByteArrayBuffer(i);
buffer = Codecs.__message.encode(buffer, answer);