question: protected final List < Record > wrapMessage ( DTLSMessage fragment ) throws HandshakeException { try { switch ( fragment . getContentType ( ) ) { case HANDSHAKE : return wrapHandshakeMessage ( ( HandshakeMessage ) fragment ) ; default : List < Record > records = new ArrayList < Record > ( ) ; records . add ( new Record ( fragment . getContentType ( ) , session . getWriteEpoch ( ) , session . getSequenceNumber ( ) , fragment , session ) ) ; return records ; } } catch ( GeneralSecurityException e ) { throw new HandshakeException ( "Cannot create record" , new AlertMessage ( AlertLevel . FATAL , AlertDescription . INTERNAL_ERROR , session . getPeer ( ) ) ) ; } }
target:  Wraps a DTLS message fragment into (potentially multiple) DTLS records. Sets the record's epoch, sequence number and handles fragmentation for handshake messages.