DHClientKeyExchangePreparator extends ClientKeyExchangePreparator<T> { @Override public void prepareHandshakeMessageContents() { LOGGER.debug("Preparing DHClientExchangeMessage"); prepareAfterParse(true); prepareDhParams(); } DHClientKeyExchangePreparator(Chooser chooser, T msg); @Override void prepareHandshakeMessageContents(); @Override void prepareAfterParse(boolean clientMode);  }
@Test public void testPrepare() { context.setSelectedProtocolVersion(ProtocolVersion.TLS12); context.setSelectedCipherSuite(CipherSuite.TLS_DH_RSA_WITH_AES_128_CBC_SHA256); context.setClientRandom(ArrayConverter.hexStringToByteArray(RANDOM)); context.setServerRandom(ArrayConverter.hexStringToByteArray(RANDOM)); context.setServerDhModulus(new BigInteger(DH_M, 16)); context.setServerDhGenerator(new BigInteger(DH_G, 16)); context.setServerDhPublicKey(SERVER_PUBLIC_KEY); preparator.prepareHandshakeMessageContents(); assertArrayEquals(PREMASTERSECRET, message.getComputations().getPremasterSecret().getValue()); assertNotNull(message.getPublicKeyLength().getValue()); assertNotNull(message.getPublicKey()); assertNotNull(message.getComputations().getClientServerRandom()); assertArrayEquals( ArrayConverter.concatenate(ArrayConverter.hexStringToByteArray(RANDOM), ArrayConverter.hexStringToByteArray(RANDOM)), message.getComputations().getClientServerRandom() .getValue()); }