HeartbeatMessage extends ProtocolMessage { @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("HeartbeatMessage:"); sb.append("\n Type: "); if (heartbeatMessageType != null && heartbeatMessageType.getValue() != null) { sb.append(HeartbeatMessageType.getHeartbeatMessageType(heartbeatMessageType.getValue())); } else { sb.append("null"); } sb.append("\n Payload Length: "); if (payloadLength != null && payloadLength.getValue() != null) { sb.append(payloadLength.getValue()); } else { sb.append("null"); } sb.append("\n Payload: "); if (payload != null && payload.getValue() != null) { sb.append(ArrayConverter.bytesToHexString(payload.getValue())); } else { sb.append("null"); } sb.append("\n Padding: "); if (padding != null && padding.getValue() != null) { sb.append(ArrayConverter.bytesToHexString(padding.getValue())); } else { sb.append("null"); } return sb.toString(); } HeartbeatMessage();  HeartbeatMessage(Config tlsConfig); ModifiableByte getHeartbeatMessageType(); void setHeartbeatMessageType(ModifiableByte heartbeatMessageType); void setHeartbeatMessageType(byte heartbeatMessageType); ModifiableInteger getPayloadLength(); void setPayloadLength(ModifiableInteger payloadLength); void setPayloadLength(int payloadLength); ModifiableByteArray getPayload(); void setPayload(ModifiableByteArray payload); void setPayload(byte[] payload); ModifiableByteArray getPadding(); void setPadding(ModifiableByteArray padding); void setPadding(byte[] padding); @Override String toString(); @Override String toCompactString(); @Override ProtocolMessageHandler getHandler(TlsContext context);  }
@Test public void testToString() { StringBuilder sb = new StringBuilder(); sb.append("HeartbeatMessage:"); sb.append("\n Type: ").append("null"); sb.append("\n Payload Length: ").append("null"); sb.append("\n Payload: ").append("null"); sb.append("\n Padding: ").append("null"); assertEquals(message.toString(), sb.toString()); }