PWDServerKeyExchangePreparator extends ServerKeyExchangePreparator<PWDServerKeyExchangeMessage> { @Override public void prepareHandshakeMessageContents() { LOGGER.debug("Preparing PWDServerKeyExchangeMessage"); msg.prepareComputations(); prepareCurveType(msg); NamedGroup group = selectNamedGroup(msg); EllipticCurve curve = CurveFactory.getCurve(group); msg.setNamedGroup(group.getValue()); prepareSalt(msg); prepareSaltLength(msg); try { preparePasswordElement(msg); } catch (CryptoException e) { throw new PreparationException("Failed to generate password element", e); } prepareScalarElement(msg); } PWDServerKeyExchangePreparator(Chooser chooser, PWDServerKeyExchangeMessage msg); @Override void prepareHandshakeMessageContents();  }
@Test public void testPrepareHandshakeMessageContents() { preparator.prepareHandshakeMessageContents(); assertEquals(EllipticCurveType.NAMED_CURVE.getValue(), (long) msg.getGroupType().getValue()); assertArrayEquals(NamedGroup.BRAINPOOLP256R1.getValue(), msg.getNamedGroup().getValue()); assertEquals(32, (long) msg.getSaltLength().getValue()); assertArrayEquals(salt, msg.getSalt().getValue()); assertEquals(32, (long) msg.getScalarLength().getValue()); assertArrayEquals(scalar, msg.getScalar().getValue()); assertEquals(65, (long) msg.getElementLength().getValue()); assertArrayEquals(element, msg.getElement().getValue()); }