ClientEsniInnerPreparator extends Preparator<ClientEsniInner> { @Override public void prepare() { LOGGER.debug("Preparing ClientEsniInner"); prepareNonce(msg); prepareServerPariNameList(msg); prepareServerNameListBytes(msg); prepareServerNameListLength(msg); preparePadding(msg); } ClientEsniInnerPreparator(Chooser chooser, ClientEsniInner message); @Override void prepare();  }
@Test public void test() { String hostName = "baz.example.com"; byte nameType = (byte) 0x00; ClientEsniInner clientEsniInner = new ClientEsniInner(); ClientEsniInnerPreparator clientEsniInnerPreparator = new ClientEsniInnerPreparator(chooser, clientEsniInner); ServerNamePair pair = new ServerNamePair(); pair.setServerNameTypeConfig(nameType); pair.setServerNameConfig(hostName.getBytes(StandardCharsets.UTF_8)); clientEsniInner.getServerNameList().add(pair); context.setEsniPaddedLength(260); clientEsniInnerPreparator.prepare(); int resultNonceLength = clientEsniInner.getClientNonce().getValue().length; int expectedNonceLength = 16; int resultServerNameListLength = clientEsniInner.getServerNameListLength().getValue(); int expectedServerNameListLength = 18; byte[] resultServerNameListBytes = clientEsniInner.getServerNameListBytes().getValue(); byte[] expectedServerNameListBytes = ArrayConverter .hexStringToByteArray("00000f62617a2e6578616d706c652e636f6d"); byte[] resultPadding = clientEsniInner.getPadding().getValue(); byte[] expectedPadding = new byte[240]; assertEquals(expectedNonceLength, resultNonceLength); assertEquals(expectedServerNameListLength, resultServerNameListLength); assertArrayEquals(expectedServerNameListBytes, resultServerNameListBytes); assertArrayEquals(expectedPadding, resultPadding); }