/**
     * Disconnects from the Hyperledger Fabric.
     * @return {Promise} A promise that will be resolved when the connection is
     * terminated.
     */
    disconnect () {
        debug('disconnect');

        // Remove all registered event listeners.
        this.businessNetworkConnection.removeAllListeners();

        // Now disconnect from the business network.
        return this.businessNetworkConnection.disconnect()
            .then(() => {
                this.connected = this.connecting = false;
            })
            .catch((error) => {
                this.connected = this.connecting = false;
                throw error;
            });
    }