In the event that a scan terminates without completing (which could happen if, for example, the serial port is closed during the scan), then there is a CCE thrown.
java.lang.ClassCastException: com.zsmartsystems.zigbee.dongle.ember.ezsp.command.EzspStartScanResponse cannot be cast to com.zsmartsystems.zigbee.dongle.ember.ezsp.command.EzspScanCompleteHandler
at com.zsmartsystems.zigbee.dongle.ember.EmberNcp.doEnergyScan(EmberNcp.java:1084)
In the event that a scan terminates without completing (which could happen if, for example, the serial port is closed during the scan), then there is a CCE thrown.