@Override
    public List<UsbSerialPort> getPorts() {
        return mPorts;
    }
@Test
    public void compositeDevice() throws Exception {
        UsbDeviceConnection usbDeviceConnection = mock(UsbDeviceConnection.class);
        UsbDevice usbDevice = mock(UsbDevice.class);
        UsbInterface massStorageInterface = mock(UsbInterface.class);
        UsbInterface controlInterface = mock(UsbInterface.class);
        UsbInterface dataInterface = mock(UsbInterface.class);
        UsbInterface hidInterface = mock(UsbInterface.class);
        UsbInterface vendorInterface = mock(UsbInterface.class);
        UsbEndpoint controlEndpoint = mock(UsbEndpoint.class);
        UsbEndpoint readEndpoint = mock(UsbEndpoint.class);
        UsbEndpoint writeEndpoint = mock(UsbEndpoint.class);

        /*
         * BBC micro:bit
         *   UsbInterface[mId=0,mAlternateSetting=0,mName=USB_MSC,mClass=8,mSubclass=6,mProtocol=80,mEndpoints=[
         *     UsbEndpoint[mAddress=130,mAttributes=2,mMaxPacketSize=64,mInterval=0]
         *     UsbEndpoint[mAddress=2,mAttributes=2,mMaxPacketSize=64,mInterval=0]]
         *   UsbInterface[mId=1,mAlternateSetting=0,mName=mbed Serial Port,mClass=2,mSubclass=2,mProtocol=1,mEndpoints=[
         *     UsbEndpoint[mAddress=131,mAttributes=3,mMaxPacketSize=16,mInterval=32]]
         *   UsbInterface[mId=2,mAlternateSetting=0,mName=mbed Serial Port,mClass=10,mSubclass=0,mProtocol=0,mEndpoints=[
         *     UsbEndpoint[mAddress=4,mAttributes=2,mMaxPacketSize=64,mInterval=0]
         *     UsbEndpoint[mAddress=132,mAttributes=2,mMaxPacketSize=64,mInterval=0]]
         *   UsbInterface[mId=3,mAlternateSetting=0,mName=CMSIS-DAP,mClass=3,mSubclass=0,mProtocol=0,mEndpoints=[
         *     UsbEndpoint[mAddress=129,mAttributes=3,mMaxPacketSize=64,mInterval=1]
         *     UsbEndpoint[mAddress=1,mAttributes=3,mMaxPacketSize=64,mInterval=1]]
         *   UsbInterface[mId=4,mAlternateSetting=0,mName=WebUSB: CMSIS-DAP,mClass=255,mSubclass=3,mProtocol=0,mEndpoints=[]
         */
        when(usbDeviceConnection.getRawDescriptors()).thenReturn(HexDump.hexStringToByteArray(
                "12 01 10 02 EF 02 01 40 28 0D 04 02 00 10 01 02 03 01\n" +
                "09 02 8B 00 05 01 00 80 FA\n" +
                "09 04 00 00 02 08 06 50 08\n" +
                "07 05 82 02 40 00 00\n" +
                "07 05 02 02 40 00 00\n" +
                "08 0B 01 02 02 02 01 04\n" +
                "09 04 01 00 01 02 02 01 04\n" +
                "05 24 00 10 01\n" +
                "05 24 01 03 02\n" +
                "04 24 02 06\n" +
                "05 24 06 01 02\n" +
                "07 05 83 03 10 00 20\n" +
                "09 04 02 00 02 0A 00 00 05\n" +
                "07 05 04 02 40 00 00\n" +
                "07 05 84 02 40 00 00\n" +
                "09 04 03 00 02 03 00 00 06\n" +
                "09 21 00 01 00 01 22 21 00\n" +
                "07 05 81 03 40 00 01\n" +
                "07 05 01 03 40 00 01\n" +
                "09 04 04 00 00 FF 03 00 07"));
        when(usbDeviceConnection.claimInterface(controlInterface,true)).thenReturn(true);
        when(usbDeviceConnection.claimInterface(dataInterface,true)).thenReturn(true);
        when(usbDevice.getInterfaceCount()).thenReturn(5);
        when(usbDevice.getInterface(0)).thenReturn(massStorageInterface);
        when(usbDevice.getInterface(1)).thenReturn(controlInterface);
        when(usbDevice.getInterface(2)).thenReturn(dataInterface);
        when(usbDevice.getInterface(3)).thenReturn(hidInterface);
        when(usbDevice.getInterface(4)).thenReturn(vendorInterface);
        when(massStorageInterface.getId()).thenReturn(0);
        when(massStorageInterface.getInterfaceClass()).thenReturn(UsbConstants.USB_CLASS_MASS_STORAGE);
        when(controlInterface.getId()).thenReturn(1);
        when(controlInterface.getInterfaceClass()).thenReturn(UsbConstants.USB_CLASS_COMM);
        when(controlInterface.getInterfaceSubclass()).thenReturn(USB_SUBCLASS_ACM);
        when(dataInterface.getId()).thenReturn(2);
        when(dataInterface.getInterfaceClass()).thenReturn(UsbConstants.USB_CLASS_CDC_DATA);
        when(hidInterface.getId()).thenReturn(3);
        when(hidInterface.getInterfaceClass()).thenReturn(UsbConstants.USB_CLASS_HID);
        when(vendorInterface.getId()).thenReturn(4);
        when(vendorInterface.getInterfaceClass()).thenReturn(UsbConstants.USB_CLASS_VENDOR_SPEC);

        when(controlInterface.getEndpointCount()).thenReturn(1);
        when(controlInterface.getEndpoint(0)).thenReturn(controlEndpoint);
        when(dataInterface.getEndpointCount()).thenReturn(2);
        when(dataInterface.getEndpoint(0)).thenReturn(writeEndpoint);
        when(dataInterface.getEndpoint(1)).thenReturn(readEndpoint);
        when(controlEndpoint.getDirection()).thenReturn(UsbConstants.USB_DIR_IN);
        when(controlEndpoint.getType()).thenReturn(UsbConstants.USB_ENDPOINT_XFER_INT);
        when(readEndpoint.getDirection()).thenReturn(UsbConstants.USB_DIR_IN);
        when(readEndpoint.getType()).thenReturn(UsbConstants.USB_ENDPOINT_XFER_BULK);
        when(writeEndpoint.getDirection()).thenReturn(UsbConstants.USB_DIR_OUT);
        when(writeEndpoint.getType()).thenReturn(UsbConstants.USB_ENDPOINT_XFER_BULK);

        CdcAcmSerialDriver driver = new CdcAcmSerialDriver(usbDevice);
        CdcAcmSerialDriver.CdcAcmSerialPort port = (CdcAcmSerialDriver.CdcAcmSerialPort) driver.getPorts().get(0);
        port.mConnection = usbDeviceConnection;
        port.openInt();
        assertEquals(readEndpoint, port.mReadEndpoint);
        assertEquals(writeEndpoint, port.mWriteEndpoint);

        ProbeTable probeTable = UsbSerialProber.getDefaultProbeTable();
        Class<? extends UsbSerialDriver> probeDriver = probeTable.findDriver(usbDevice);
        assertEquals(driver.getClass(), probeDriver);
    }