@Override
    public ObjectNode encode(LispTeAddress address, CodecContext context) {
        checkNotNull(address, "LispTeAddress cannot be null");

        final ObjectNode result = context.mapper().createObjectNode();
        final ArrayNode jsonRecords = result.putArray(TE_RECORDS);

        final JsonCodec<LispTeAddress.TeRecord> recordCodec =
                context.codec(LispTeAddress.TeRecord.class);

        for (final LispTeAddress.TeRecord record : address.getTeRecords()) {
            jsonRecords.add(recordCodec.encode(record, context));
        }

        return result;
    }
@Test
    public void testLispTeAddressEncode() {

        LispTeAddress address = new LispTeAddress.Builder()
                .withTeRecords(ImmutableList.of(record1, record2))
                .build();

        ObjectNode addressJson = teAddressCodec.encode(address, context);
        assertThat("errors in encoding Traffic Engineering address JSON",
                addressJson, LispTeAddressJsonMatcher.matchesTeAddress(address));
    }