ServerHelloMessage extends HelloMessage { @Override public String toString() { StringBuilder sb = new StringBuilder(super.toString()); sb.append("\n Protocol Version: "); if (getProtocolVersion() != null) { sb.append(ProtocolVersion.getProtocolVersion(getProtocolVersion().getValue())); } else { sb.append("null"); } if (getProtocolVersion() != null && getProtocolVersion().getValue() != null && !ProtocolVersion.getProtocolVersion(getProtocolVersion().getValue()).isTLS13()) { sb.append("\n Server Unix Time: ").append( new Date(ArrayConverter.bytesToLong(getUnixTime().getValue()) * 1000)); } sb.append("\n Server Unix Time: "); if (getProtocolVersion() != null) { if (!ProtocolVersion.getProtocolVersion(getProtocolVersion().getValue()).isTLS13()) { sb.append(new Date(ArrayConverter.bytesToLong(getUnixTime().getValue()) * 1000)); } else { sb.append("null"); } } else { sb.append("null"); } sb.append("\n Server Random: "); if (getRandom() != null) { sb.append(ArrayConverter.bytesToHexString(getRandom().getValue())); } else { sb.append("null"); } sb.append("\n Session ID: "); if (getProtocolVersion() != null && getProtocolVersion().getValue() != null) { if (!ProtocolVersion.getProtocolVersion(getProtocolVersion().getValue()).isTLS13()) { sb.append(ArrayConverter.bytesToHexString(getSessionId().getValue())); } else { sb.append("null"); } } else { sb.append("null"); } sb.append("\n Selected Cipher Suite: "); if (selectedCipherSuite != null && selectedCipherSuite.getValue() != null) { sb.append(CipherSuite.getCipherSuite(selectedCipherSuite.getValue())); } else { sb.append("null"); } sb.append("\n Selected Compression Method: "); if (getProtocolVersion() != null && getProtocolVersion().getValue() != null) { if (!ProtocolVersion.getProtocolVersion(getProtocolVersion().getValue()).isTLS13()) { sb.append(CompressionMethod.getCompressionMethod(selectedCompressionMethod.getValue())); } else { sb.append("null"); } } else { sb.append("null"); } sb.append("\n Extensions: "); if (getExtensions() == null) { sb.append("null"); } else { for (ExtensionMessage e : getExtensions()) { sb.append(e.toString()); } } return sb.toString(); } ServerHelloMessage(Config tlsConfig);  ServerHelloMessage(); ModifiableByteArray getSelectedCipherSuite(); void setSelectedCipherSuite(ModifiableByteArray selectedCipherSuite); void setSelectedCipherSuite(byte[] value); ModifiableByte getSelectedCompressionMethod(); void setSelectedCompressionMethod(ModifiableByte selectedCompressionMethod); void setSelectedCompressionMethod(byte value); Boolean isTls13HelloRetryRequest(); @Override String toString(); @Override ProtocolMessageHandler getHandler(TlsContext context);  }
@Test public void testToString() { StringBuilder sb = new StringBuilder(); sb.append("HandshakeMessage:"); sb.append("\n Type: ").append("null"); sb.append("\n Length: ").append("null"); sb.append("\n Protocol Version: ").append("null"); sb.append("\n Server Unix Time: ").append("null"); sb.append("\n Server Random: ").append("null"); sb.append("\n Session ID: ").append("null"); sb.append("\n Selected Cipher Suite: ").append("null"); sb.append("\n Selected Compression Method: ").append("null"); sb.append("\n Extensions: ").append("null"); assertEquals(sb.toString(), message.toString()); }