@Override
    public XmppDevice getDevice(XmppDeviceId xmppDeviceId) {
        return connectedDevices.get(xmppDeviceId);
    }
@Test
    public void testAddRemoveConnectedDevice() {
        // test adding connected devices
        boolean add1 = agent.addConnectedDevice(jid1, device1);
        assertThat(add1, is(true));
        assertThat(testXmppDeviceListener.addedDevices, hasSize(1));
        boolean add2 = agent.addConnectedDevice(jid2, device2);
        assertThat(add2, is(true));
        assertThat(testXmppDeviceListener.addedDevices, hasSize(2));
        boolean add3 = agent.addConnectedDevice(jid3, device3);
        assertThat(add3, is(true));
        assertThat(testXmppDeviceListener.addedDevices, hasSize(3));

        assertThat(testXmppDeviceListener.addedDevices, hasItems(jid1, jid2, jid3));

        // Test adding a device twice - it should fail
        boolean addError1 = agent.addConnectedDevice(jid1, device1);
        assertThat(addError1, is(false));

        assertThat(controller.connectedDevices.size(), is(3));

        // test querying the individual device
        XmppDevice queriedDevice = controller.getDevice(jid1);
        assertThat(queriedDevice, is(device1));

        // test removing device
        agent.removeConnectedDevice(jid3);
        assertThat(controller.connectedDevices.size(), is(2));

        // Make sure the listener delete callbacks fired
        assertThat(testXmppDeviceListener.removedDevices, hasSize(1));
        assertThat(testXmppDeviceListener.removedDevices, hasItems(jid3));
    }