@@ -121,6 +121,18 @@ static class Side
121121 Side client , server ;
122122
123123 void setUpPair (int cipherSuite , int hash ) throws IOException
124+ {
125+ setUpPair (cipherSuite , hash , null , null );
126+ }
127+
128+ /**
129+ * As {@link #setUpPair(int, int)}, but each side's completed-handshake transition is driven with its own
130+ * {@link DTLSHandshakeRetransmit}, retaining the handshake epoch (RFC 9147 5.8.1) for that side instead of
131+ * dropping it. Pass null for a side that should complete the handshake with nothing retained, exactly as
132+ * {@link #setUpPair(int, int)} does for both sides.
133+ */
134+ void setUpPair (int cipherSuite , int hash , DTLSHandshakeRetransmit clientRetransmit ,
135+ DTLSHandshakeRetransmit serverRetransmit ) throws IOException
124136 {
125137 TlsCrypto crypto = new BcTlsCrypto ();
126138 byte [] clientSecret = new byte [48 ];
@@ -132,13 +144,14 @@ void setUpPair(int cipherSuite, int hash) throws IOException
132144 serverToClient = new Queue ();
133145
134146 client = createSide (crypto , false , cipherSuite , hash , clientSecret , serverSecret ,
135- new QueueTransport (serverToClient , clientToServer ));
147+ new QueueTransport (serverToClient , clientToServer ), clientRetransmit );
136148 server = createSide (crypto , true , cipherSuite , hash , clientSecret , serverSecret ,
137- new QueueTransport (clientToServer , serverToClient ));
149+ new QueueTransport (clientToServer , serverToClient ), serverRetransmit );
138150 }
139151
140152 private static Side createSide (TlsCrypto crypto , boolean isServer , int cipherSuite , int hash ,
141- byte [] clientSecret , byte [] serverSecret , DatagramTransport transport ) throws IOException
153+ byte [] clientSecret , byte [] serverSecret , DatagramTransport transport ,
154+ DTLSHandshakeRetransmit retransmit ) throws IOException
142155 {
143156 AbstractTlsContext context = TlsAEADCipherDTLS13Test .createContext (crypto , isServer , cipherSuite , hash ,
144157 clientSecret , serverSecret );
@@ -166,7 +179,7 @@ public TlsAuthentication getAuthentication()
166179 checkEquals (3 , recordLayer .getPendingEpoch ());
167180 recordLayer .enablePendingEpochWrite ();
168181 recordLayer .enablePendingEpochRead ();
169- recordLayer .handshakeSuccessful (null );
182+ recordLayer .handshakeSuccessful (retransmit );
170183
171184 checkEquals (3 , recordLayer .getReadEpoch ());
172185
0 commit comments