@Test(expected = Exception.class) public void testReadFrom1() throws Exception { byte[] temp = {0, 0, 0}; inputByteArray = temp; lsaHeader = createLsaHeader(); networkLsa = new NetworkLsa(lsaHeader); channelBuffer = ChannelBuffers.copiedBuffer(inputByteArray); networkLsa.readFrom(channelBuffer); assertThat(networkLsa, is(notNullValue())); }
public void readFrom(ChannelBuffer channelBuffer) throws OspfParseException { try { byte[] tempByteArray = new byte[OspfUtil.FOUR_BYTES]; channelBuffer.readBytes(tempByteArray, 0, OspfUtil.FOUR_BYTES); this.setNetworkMask(Ip4Address.valueOf(tempByteArray)); while (channelBuffer.readableBytes() > 0) { tempByteArray = new byte[OspfUtil.FOUR_BYTES]; channelBuffer.readBytes(tempByteArray, 0, OspfUtil.FOUR_BYTES); this.addAttachedRouter(Ip4Address.valueOf(tempByteArray)); } } catch (Exception e) { log.debug("Error::NetworkLSA::readFrom:: {}", e.getMessage()); throw new OspfParseException(OspfErrorType.OSPF_MESSAGE_ERROR, OspfErrorType.BAD_MESSAGE); } }
NetworkLsa extends LsaHeader { public void readFrom(ChannelBuffer channelBuffer) throws OspfParseException { try { byte[] tempByteArray = new byte[OspfUtil.FOUR_BYTES]; channelBuffer.readBytes(tempByteArray, 0, OspfUtil.FOUR_BYTES); this.setNetworkMask(Ip4Address.valueOf(tempByteArray)); while (channelBuffer.readableBytes() > 0) { tempByteArray = new byte[OspfUtil.FOUR_BYTES]; channelBuffer.readBytes(tempByteArray, 0, OspfUtil.FOUR_BYTES); this.addAttachedRouter(Ip4Address.valueOf(tempByteArray)); } } catch (Exception e) { log.debug("Error::NetworkLSA::readFrom:: {}", e.getMessage()); throw new OspfParseException(OspfErrorType.OSPF_MESSAGE_ERROR, OspfErrorType.BAD_MESSAGE); } } }
NetworkLsa extends LsaHeader { public void readFrom(ChannelBuffer channelBuffer) throws OspfParseException { try { byte[] tempByteArray = new byte[OspfUtil.FOUR_BYTES]; channelBuffer.readBytes(tempByteArray, 0, OspfUtil.FOUR_BYTES); this.setNetworkMask(Ip4Address.valueOf(tempByteArray)); while (channelBuffer.readableBytes() > 0) { tempByteArray = new byte[OspfUtil.FOUR_BYTES]; channelBuffer.readBytes(tempByteArray, 0, OspfUtil.FOUR_BYTES); this.addAttachedRouter(Ip4Address.valueOf(tempByteArray)); } } catch (Exception e) { log.debug("Error::NetworkLSA::readFrom:: {}", e.getMessage()); throw new OspfParseException(OspfErrorType.OSPF_MESSAGE_ERROR, OspfErrorType.BAD_MESSAGE); } } NetworkLsa();  NetworkLsa(LsaHeader lsaHeader); }
NetworkLsa extends LsaHeader { public void readFrom(ChannelBuffer channelBuffer) throws OspfParseException { try { byte[] tempByteArray = new byte[OspfUtil.FOUR_BYTES]; channelBuffer.readBytes(tempByteArray, 0, OspfUtil.FOUR_BYTES); this.setNetworkMask(Ip4Address.valueOf(tempByteArray)); while (channelBuffer.readableBytes() > 0) { tempByteArray = new byte[OspfUtil.FOUR_BYTES]; channelBuffer.readBytes(tempByteArray, 0, OspfUtil.FOUR_BYTES); this.addAttachedRouter(Ip4Address.valueOf(tempByteArray)); } } catch (Exception e) { log.debug("Error::NetworkLSA::readFrom:: {}", e.getMessage()); throw new OspfParseException(OspfErrorType.OSPF_MESSAGE_ERROR, OspfErrorType.BAD_MESSAGE); } } NetworkLsa();  NetworkLsa(LsaHeader lsaHeader); Ip4Address networkMask(); void setNetworkMask(Ip4Address networkMask); void addAttachedRouter(Ip4Address attachedRouter); List<Ip4Address> attachedRouters(); void readFrom(ChannelBuffer channelBuffer); byte[] asBytes(); byte[] getLsaBodyAsByteArray(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }
NetworkLsa extends LsaHeader { public void readFrom(ChannelBuffer channelBuffer) throws OspfParseException { try { byte[] tempByteArray = new byte[OspfUtil.FOUR_BYTES]; channelBuffer.readBytes(tempByteArray, 0, OspfUtil.FOUR_BYTES); this.setNetworkMask(Ip4Address.valueOf(tempByteArray)); while (channelBuffer.readableBytes() > 0) { tempByteArray = new byte[OspfUtil.FOUR_BYTES]; channelBuffer.readBytes(tempByteArray, 0, OspfUtil.FOUR_BYTES); this.addAttachedRouter(Ip4Address.valueOf(tempByteArray)); } } catch (Exception e) { log.debug("Error::NetworkLSA::readFrom:: {}", e.getMessage()); throw new OspfParseException(OspfErrorType.OSPF_MESSAGE_ERROR, OspfErrorType.BAD_MESSAGE); } } NetworkLsa();  NetworkLsa(LsaHeader lsaHeader); Ip4Address networkMask(); void setNetworkMask(Ip4Address networkMask); void addAttachedRouter(Ip4Address attachedRouter); List<Ip4Address> attachedRouters(); void readFrom(ChannelBuffer channelBuffer); byte[] asBytes(); byte[] getLsaBodyAsByteArray(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }