@@ -182,13 +182,13 @@ public void testRetransmissionOfTheFinalFlightIsRecognised()
182182 FINISHED_LENGTH );
183183
184184 assertTrue ("a retransmission of the final flight must be answered" ,
185- DTLSReliableHandshake .matchesFlight (flight , 2 , record , 0 , record .length ));
185+ DTLSReliableHandshake .matchesFlight (flight , 2 , 2 , record , 0 , record .length ));
186186
187187 byte [] firstHalf = handshakeRecord (HandshakeType .finished , FINISHED_LENGTH , FINAL_FLIGHT_SEQ , 0 ,
188188 FINISHED_LENGTH / 2 );
189189
190190 assertTrue ("a fragment of the final flight must be answered" ,
191- DTLSReliableHandshake .matchesFlight (flight , 2 , firstHalf , 0 , firstHalf .length ));
191+ DTLSReliableHandshake .matchesFlight (flight , 2 , 2 , firstHalf , 0 , firstHalf .length ));
192192 }
193193
194194 public void testUnauthenticatedEpochIsNotTakenForTheFinalFlight ()
@@ -199,9 +199,12 @@ public void testUnauthenticatedEpochIsNotTakenForTheFinalFlight()
199199 FINISHED_LENGTH );
200200
201201 assertFalse ("epoch 0 is unauthenticated and carries none of the final flight" ,
202- DTLSReliableHandshake .matchesFlight (flight , 0 , record , 0 , record .length ));
202+ DTLSReliableHandshake .matchesFlight (flight , 2 , 0 , record , 0 , record .length ));
203203 assertFalse ("the application epoch carries no handshake flight" ,
204- DTLSReliableHandshake .matchesFlight (flight , 3 , record , 0 , record .length ));
204+ DTLSReliableHandshake .matchesFlight (flight , 2 , 3 , record , 0 , record .length ));
205+
206+ assertFalse ("with no epoch retired there is nothing to recognise" ,
207+ DTLSReliableHandshake .matchesFlight (flight , -1 , -1 , record , 0 , record .length ));
205208 }
206209
207210 public void testForeignHandshakeRecordIsNotTakenForTheFinalFlight ()
@@ -211,30 +214,30 @@ public void testForeignHandshakeRecordIsNotTakenForTheFinalFlight()
211214 byte [] otherSeq = handshakeRecord (HandshakeType .finished , FINISHED_LENGTH , FINAL_FLIGHT_SEQ + 1 , 0 ,
212215 FINISHED_LENGTH );
213216 assertFalse ("a message_seq the flight never contained" ,
214- DTLSReliableHandshake .matchesFlight (flight , 2 , otherSeq , 0 , otherSeq .length ));
217+ DTLSReliableHandshake .matchesFlight (flight , 2 , 2 , otherSeq , 0 , otherSeq .length ));
215218
216219 byte [] otherType = handshakeRecord (HandshakeType .key_update , FINISHED_LENGTH , FINAL_FLIGHT_SEQ , 0 ,
217220 FINISHED_LENGTH );
218221 assertFalse ("a different message under the flight's message_seq" ,
219- DTLSReliableHandshake .matchesFlight (flight , 2 , otherType , 0 , otherType .length ));
222+ DTLSReliableHandshake .matchesFlight (flight , 2 , 2 , otherType , 0 , otherType .length ));
220223
221224 byte [] otherLength = handshakeRecord (HandshakeType .finished , FINISHED_LENGTH + 1 , FINAL_FLIGHT_SEQ , 0 ,
222225 FINISHED_LENGTH + 1 );
223226 assertFalse ("a different length under the flight's message_seq" ,
224- DTLSReliableHandshake .matchesFlight (flight , 2 , otherLength , 0 , otherLength .length ));
227+ DTLSReliableHandshake .matchesFlight (flight , 2 , 2 , otherLength , 0 , otherLength .length ));
225228
226229 byte [] record = handshakeRecord (HandshakeType .finished , FINISHED_LENGTH , FINAL_FLIGHT_SEQ , 0 ,
227230 FINISHED_LENGTH );
228231 assertFalse ("a truncated record" ,
229- DTLSReliableHandshake .matchesFlight (flight , 2 , record , 0 , record .length - 1 ));
232+ DTLSReliableHandshake .matchesFlight (flight , 2 , 2 , record , 0 , record .length - 1 ));
230233 assertFalse ("a record too short to hold a message header" ,
231- DTLSReliableHandshake .matchesFlight (flight , 2 , record , 0 , 4 ));
234+ DTLSReliableHandshake .matchesFlight (flight , 2 , 2 , record , 0 , 4 ));
232235
233236 byte [] pair = new byte [record .length + otherSeq .length ];
234237 System .arraycopy (record , 0 , pair , 0 , record .length );
235238 System .arraycopy (otherSeq , 0 , pair , record .length , otherSeq .length );
236239 assertFalse ("one fragment of the flight does not excuse a foreign one beside it" ,
237- DTLSReliableHandshake .matchesFlight (flight , 2 , pair , 0 , pair .length ));
240+ DTLSReliableHandshake .matchesFlight (flight , 2 , 2 , pair , 0 , pair .length ));
238241 }
239242
240243 public void testUnacknowledgedFlightStillRetransmitsEverything () throws Exception
0 commit comments