@Override
    public byte[] serialize() {
        byte[] actorInfo = Optional.ofNullable(tlv.get(TYPE_ACTOR)).map(LacpTlv::serialize)
                .orElse(new byte[0]);
        byte[] partnerInfo = Optional.ofNullable(tlv.get(TYPE_PARTNER)).map(LacpTlv::serialize)
                .orElse(new byte[0]);
        byte[] collectorInfo = Optional.ofNullable(tlv.get(TYPE_COLLECTOR)).map(LacpTlv::serialize)
                .orElse(new byte[0]);
        byte[] terminatorInfo = Optional.ofNullable(tlv.get(TYPE_TERMINATOR)).map(LacpTlv::serialize)
                .orElse(new byte[0]);

        final byte[] data = new byte[HEADER_LENGTH
                + LacpTlv.HEADER_LENGTH + actorInfo.length
                + LacpTlv.HEADER_LENGTH + partnerInfo.length
                + LacpTlv.HEADER_LENGTH + collectorInfo.length
                + LacpTlv.HEADER_LENGTH + terminatorInfo.length];

        final ByteBuffer bb = ByteBuffer.wrap(data);
        bb.put(lacpVersion);
        bb.put(TYPE_ACTOR);
        bb.put(LacpBaseTlv.LENGTH);
        bb.put(actorInfo);
        bb.put(TYPE_PARTNER);
        bb.put(LacpBaseTlv.LENGTH);
        bb.put(partnerInfo);
        bb.put(TYPE_COLLECTOR);
        bb.put(LacpCollectorTlv.LENGTH);
        bb.put(collectorInfo);
        bb.put(TYPE_TERMINATOR);
        bb.put(LacpTerminatorTlv.LENGTH);
        bb.put(terminatorInfo);

        return data;
    }
@Test
    public void serialize() {
        assertArrayEquals(data, LACP.serialize());
    }