@Test public void testReadFrom() throws Exception { tlvHeader = new TlvHeader(); tlvHeader.setTlvType(1); tlvHeader.setTlvLength(4); linkType = new LinkType(tlvHeader); channelBuffer = ChannelBuffers.copiedBuffer(packet); linkType.readFrom(channelBuffer); assertThat(linkType, is(notNullValue())); }
public void readFrom(ChannelBuffer channelBuffer) throws Exception { try { int len = channelBuffer.readableBytes(); byte[] tempByteArray = new byte[len]; channelBuffer.readBytes(tempByteArray, 0, len); this.setLinkType(OspfUtil.byteToInteger(tempByteArray)); } catch (Exception e) { log.debug("Error::LinkType:: {}", e.getMessage()); throw new OspfParseException(OspfErrorType.OSPF_MESSAGE_ERROR, OspfErrorType.BAD_MESSAGE); } }
LinkType extends TlvHeader implements LinkSubType { public void readFrom(ChannelBuffer channelBuffer) throws Exception { try { int len = channelBuffer.readableBytes(); byte[] tempByteArray = new byte[len]; channelBuffer.readBytes(tempByteArray, 0, len); this.setLinkType(OspfUtil.byteToInteger(tempByteArray)); } catch (Exception e) { log.debug("Error::LinkType:: {}", e.getMessage()); throw new OspfParseException(OspfErrorType.OSPF_MESSAGE_ERROR, OspfErrorType.BAD_MESSAGE); } } }
LinkType extends TlvHeader implements LinkSubType { public void readFrom(ChannelBuffer channelBuffer) throws Exception { try { int len = channelBuffer.readableBytes(); byte[] tempByteArray = new byte[len]; channelBuffer.readBytes(tempByteArray, 0, len); this.setLinkType(OspfUtil.byteToInteger(tempByteArray)); } catch (Exception e) { log.debug("Error::LinkType:: {}", e.getMessage()); throw new OspfParseException(OspfErrorType.OSPF_MESSAGE_ERROR, OspfErrorType.BAD_MESSAGE); } } LinkType();  LinkType(TlvHeader header); }
LinkType extends TlvHeader implements LinkSubType { public void readFrom(ChannelBuffer channelBuffer) throws Exception { try { int len = channelBuffer.readableBytes(); byte[] tempByteArray = new byte[len]; channelBuffer.readBytes(tempByteArray, 0, len); this.setLinkType(OspfUtil.byteToInteger(tempByteArray)); } catch (Exception e) { log.debug("Error::LinkType:: {}", e.getMessage()); throw new OspfParseException(OspfErrorType.OSPF_MESSAGE_ERROR, OspfErrorType.BAD_MESSAGE); } } LinkType();  LinkType(TlvHeader header); void setLinkType(int linkType); void readFrom(ChannelBuffer channelBuffer); byte[] asBytes(); byte[] getLinkSubTypeTlvBodyAsByteArray(); @Override String toString(); }
LinkType extends TlvHeader implements LinkSubType { public void readFrom(ChannelBuffer channelBuffer) throws Exception { try { int len = channelBuffer.readableBytes(); byte[] tempByteArray = new byte[len]; channelBuffer.readBytes(tempByteArray, 0, len); this.setLinkType(OspfUtil.byteToInteger(tempByteArray)); } catch (Exception e) { log.debug("Error::LinkType:: {}", e.getMessage()); throw new OspfParseException(OspfErrorType.OSPF_MESSAGE_ERROR, OspfErrorType.BAD_MESSAGE); } } LinkType();  LinkType(TlvHeader header); void setLinkType(int linkType); void readFrom(ChannelBuffer channelBuffer); byte[] asBytes(); byte[] getLinkSubTypeTlvBodyAsByteArray(); @Override String toString();  }