@@ -780,6 +780,58 @@ testParseGenerate('connack MQTT5 with properties', {
780780 22 , 0 , 4 , 1 , 2 , 3 , 4 // authenticationData
781781] ) , { protocolVersion : 5 } )
782782
783+ testParseGenerate ( 'connack MQTT5 with properties and doubled user properties' , {
784+ cmd : 'connack' ,
785+ retain : false ,
786+ qos : 0 ,
787+ dup : false ,
788+ length : 100 ,
789+ sessionPresent : false ,
790+ reasonCode : 0 ,
791+ properties : {
792+ sessionExpiryInterval : 1234 ,
793+ receiveMaximum : 432 ,
794+ maximumQoS : 2 ,
795+ retainAvailable : true ,
796+ maximumPacketSize : 100 ,
797+ assignedClientIdentifier : 'test' ,
798+ topicAliasMaximum : 456 ,
799+ reasonString : 'test' ,
800+ userProperties : {
801+ 'test' : [ 'test' , 'test' ]
802+ } ,
803+ wildcardSubscriptionAvailable : true ,
804+ subscriptionIdentifiersAvailable : true ,
805+ sharedSubscriptionAvailable : false ,
806+ serverKeepAlive : 1234 ,
807+ responseInformation : 'test' ,
808+ serverReference : 'test' ,
809+ authenticationMethod : 'test' ,
810+ authenticationData : Buffer . from ( [ 1 , 2 , 3 , 4 ] )
811+ }
812+ } , Buffer . from ( [
813+ 32 , 100 , 0 , 0 ,
814+ 97 , // properties length
815+ 17 , 0 , 0 , 4 , 210 , // sessionExpiryInterval
816+ 33 , 1 , 176 , // receiveMaximum
817+ 36 , 2 , // Maximum qos
818+ 37 , 1 , // retainAvailable
819+ 39 , 0 , 0 , 0 , 100 , // maximumPacketSize
820+ 18 , 0 , 4 , 116 , 101 , 115 , 116 , // assignedClientIdentifier
821+ 34 , 1 , 200 , // topicAliasMaximum
822+ 31 , 0 , 4 , 116 , 101 , 115 , 116 , // reasonString
823+ 38 , 0 , 4 , 116 , 101 , 115 , 116 , 0 , 4 , 116 , 101 , 115 , 116 ,
824+ 38 , 0 , 4 , 116 , 101 , 115 , 116 , 0 , 4 , 116 , 101 , 115 , 116 , // userProperties
825+ 40 , 1 , // wildcardSubscriptionAvailable
826+ 41 , 1 , // subscriptionIdentifiersAvailable
827+ 42 , 0 , // sharedSubscriptionAvailable
828+ 19 , 4 , 210 , // serverKeepAlive
829+ 26 , 0 , 4 , 116 , 101 , 115 , 116 , // responseInformation
830+ 28 , 0 , 4 , 116 , 101 , 115 , 116 , // serverReference
831+ 21 , 0 , 4 , 116 , 101 , 115 , 116 , // authenticationMethod
832+ 22 , 0 , 4 , 1 , 2 , 3 , 4 // authenticationData
833+ ] ) , { protocolVersion : 5 } )
834+
783835testParseGenerate ( 'connack with return code 0 session present bit set' , {
784836 cmd : 'connack' ,
785837 retain : false ,
0 commit comments