constructor(socket, tokenProvider) {
        this.miioSocket = socket;
        this.miioSocket.registerOnEmptyPacketHook(this.checkHandshakeCompleted.bind(this));
        this.tokenProvider = tokenProvider;

        this.mutex = Semaphore(1);

        this.handshake().then(() => {
            Logger.trace(`Initial handshake successful. Stamp ${this.miioSocket.codec.stamp.val}`);
        }).catch((e) => {
            Logger.warn("Error in initial handshake", e);
        });
    }
@param {import("./MiioSocket")} socket
@param {() => Buffer} tokenProvider