func handshake(t *testing.T, cleanSess bool, id string, keepAlive int, auth *ConnectAuth, stream Stream) *ConnAckPacket {

	stream.WritePacket(Connect("MQTT", 0x04, cleanSess, keepAlive, id, nil, auth))

	packet, err := stream.ReadPacket()
	if err != nil {
		t.Fatalf("initial read failed: %v", err)
	}
	if !reflect.DeepEqual(lastAuth, simpleAuth) {
		t.Fatalf("auth was not passed to server: %v", lastAuth)
	}
	return packet.(*ConnAckPacket)
}
// handshake = MQTT Connect + ConAck
handshake = MQTT Connect + ConAck
// handshake = MQTT Connect + ConAck
func handshake(t *testing.T, cleanSess bool, id string, keepAlive int, auth *ConnectAuth, stream Stream) *ConnAckPacket {
	stream.WritePacket(Connect("MQTT", 0x04, cleanSess, keepAlive, id, nil, auth))
	packet, err := stream.ReadPacket()
	if err != nil {
		t.Fatalf("initial read failed: %v", err)
	}
	if !reflect.DeepEqual(lastAuth, simpleAuth) {
		t.Fatalf("auth was not passed to server: %v", lastAuth)
	}
	return packet.(*ConnAckPacket)
}
func handshake ( t * testing . T , cleanSess bool , id string , keepAlive int , auth * ConnectAuth , stream Stream ) * ConnAckPacket { stream . WritePacket ( Connect ( " " , 0x04 , cleanSess , keepAlive , id , nil , auth ) ) packet , err := stream . ReadPacket ( ) if err != nil { t . Fatalf ( " " , err ) } if ! reflect . DeepEqual ( lastAuth , simpleAuth ) { t . Fatalf ( " " , lastAuth ) } return packet . ( * ConnAckPacket ) }
handshake = MQTT Connect + ConAck
handshake = MQTT Connect + ConAck