TestCase.assertEquals(1, msg.getVendor());
}
public void testVendorData() throws Exception {
OFVendor msg = makeVendorMessage(ACME_VENDOR_ID);
OFVendorData vendorData = new AcmeVendorData1((short)11, (short)22);
msg.setVendorData(vendorData);
msg.setLengthU(OFVendor.MINIMUM_LENGTH + vendorData.getLength());
ChannelBuffer bb = ChannelBuffers.dynamicBuffer();
bb.clear();
msg.writeTo(bb);
msg.readFrom(bb);
assertEquals(ACME_VENDOR_ID, msg.getVendor());
AcmeVendorData1 vendorData1 = (AcmeVendorData1) msg.getVendorData();
assertEquals(11, vendorData1.getFlags());
assertEquals(22, vendorData1.getValue());
vendorData = new AcmeVendorData2(33, 44);
msg.setVendorData(vendorData);
msg.setLengthU(OFVendor.MINIMUM_LENGTH + vendorData.getLength());
bb.clear();
msg.writeTo(bb);
msg.readFrom(bb);
assertEquals(ACME_VENDOR_ID, msg.getVendor());
AcmeVendorData2 vendorData2 = (AcmeVendorData2) msg.getVendorData();
assertEquals(33, vendorData2.getType());
assertEquals(44, vendorData2.getSubtype());
final int DUMMY_VENDOR_ID = 55;
msg.setVendor(DUMMY_VENDOR_ID);
byte[] genericVendorDataBytes = new byte[] {0x55, 0x66};
vendorData = new OFByteArrayVendorData(genericVendorDataBytes);
msg.setVendorData(vendorData);
msg.setLengthU(OFVendor.MINIMUM_LENGTH + vendorData.getLength());
bb.clear();
msg.writeTo(bb);
msg.readFrom(bb);
assertEquals(DUMMY_VENDOR_ID, msg.getVendor());
OFByteArrayVendorData genericVendorData = (OFByteArrayVendorData) msg.getVendorData();