@Test public void testGetLsrBodyAsByteArray() throws Exception { lsRequest.addLinkStateRequests(createLsRequestPacket()); lsRequest.addLinkStateRequests(new LsRequestPacket()); result1 = lsRequest.getLsrBodyAsByteArray(); assertThat(result1, is(notNullValue())); }
public byte[] getLsrBodyAsByteArray() { List<Byte> bodyLst = new ArrayList<>(); try { for (LsRequestPacket lsrPacket : linkStateRequests) { bodyLst.addAll(Bytes.asList(OspfUtil.convertToFourBytes(lsrPacket.lsType()))); bodyLst.addAll(Bytes.asList(InetAddress.getByName(lsrPacket.linkStateId()).getAddress())); bodyLst.addAll(Bytes.asList(InetAddress.getByName(lsrPacket.ownRouterId()).getAddress())); } } catch (Exception e) { log.debug("Error::getLsrBodyAsByteArray {}", e.getMessage()); return Bytes.toArray(bodyLst); } return Bytes.toArray(bodyLst); }
LsRequest extends OspfPacketHeader { public byte[] getLsrBodyAsByteArray() { List<Byte> bodyLst = new ArrayList<>(); try { for (LsRequestPacket lsrPacket : linkStateRequests) { bodyLst.addAll(Bytes.asList(OspfUtil.convertToFourBytes(lsrPacket.lsType()))); bodyLst.addAll(Bytes.asList(InetAddress.getByName(lsrPacket.linkStateId()).getAddress())); bodyLst.addAll(Bytes.asList(InetAddress.getByName(lsrPacket.ownRouterId()).getAddress())); } } catch (Exception e) { log.debug("Error::getLsrBodyAsByteArray {}", e.getMessage()); return Bytes.toArray(bodyLst); } return Bytes.toArray(bodyLst); } }
LsRequest extends OspfPacketHeader { public byte[] getLsrBodyAsByteArray() { List<Byte> bodyLst = new ArrayList<>(); try { for (LsRequestPacket lsrPacket : linkStateRequests) { bodyLst.addAll(Bytes.asList(OspfUtil.convertToFourBytes(lsrPacket.lsType()))); bodyLst.addAll(Bytes.asList(InetAddress.getByName(lsrPacket.linkStateId()).getAddress())); bodyLst.addAll(Bytes.asList(InetAddress.getByName(lsrPacket.ownRouterId()).getAddress())); } } catch (Exception e) { log.debug("Error::getLsrBodyAsByteArray {}", e.getMessage()); return Bytes.toArray(bodyLst); } return Bytes.toArray(bodyLst); } LsRequest();  LsRequest(OspfPacketHeader ospfHeader); }
LsRequest extends OspfPacketHeader { public byte[] getLsrBodyAsByteArray() { List<Byte> bodyLst = new ArrayList<>(); try { for (LsRequestPacket lsrPacket : linkStateRequests) { bodyLst.addAll(Bytes.asList(OspfUtil.convertToFourBytes(lsrPacket.lsType()))); bodyLst.addAll(Bytes.asList(InetAddress.getByName(lsrPacket.linkStateId()).getAddress())); bodyLst.addAll(Bytes.asList(InetAddress.getByName(lsrPacket.ownRouterId()).getAddress())); } } catch (Exception e) { log.debug("Error::getLsrBodyAsByteArray {}", e.getMessage()); return Bytes.toArray(bodyLst); } return Bytes.toArray(bodyLst); } LsRequest();  LsRequest(OspfPacketHeader ospfHeader); void addLinkStateRequests(LsRequestPacket lsRequestPacket); List<LsRequestPacket> getLinkStateRequests(); @Override OspfPacketType ospfMessageType(); @Override void readFrom(ChannelBuffer channelBuffer); @Override byte[] asBytes(); byte[] getLsrHeaderAsByteArray(); byte[] getLsrBodyAsByteArray(); @Override String toString(); }
LsRequest extends OspfPacketHeader { public byte[] getLsrBodyAsByteArray() { List<Byte> bodyLst = new ArrayList<>(); try { for (LsRequestPacket lsrPacket : linkStateRequests) { bodyLst.addAll(Bytes.asList(OspfUtil.convertToFourBytes(lsrPacket.lsType()))); bodyLst.addAll(Bytes.asList(InetAddress.getByName(lsrPacket.linkStateId()).getAddress())); bodyLst.addAll(Bytes.asList(InetAddress.getByName(lsrPacket.ownRouterId()).getAddress())); } } catch (Exception e) { log.debug("Error::getLsrBodyAsByteArray {}", e.getMessage()); return Bytes.toArray(bodyLst); } return Bytes.toArray(bodyLst); } LsRequest();  LsRequest(OspfPacketHeader ospfHeader); void addLinkStateRequests(LsRequestPacket lsRequestPacket); List<LsRequestPacket> getLinkStateRequests(); @Override OspfPacketType ospfMessageType(); @Override void readFrom(ChannelBuffer channelBuffer); @Override byte[] asBytes(); byte[] getLsrHeaderAsByteArray(); byte[] getLsrBodyAsByteArray(); @Override String toString();  }