@Override
    public void startServerSentEvents(DeviceId deviceId, String eventsUrl) {
        this.getServerSentEvents(deviceId, eventsUrl,
                (event) -> sendEvent(event, deviceId),
                (error) -> log.error("Unable to handle {} SSEvent from {}. {}",
                        eventsUrl, deviceId, error));
    }
@Test
    public void testStartServerSentEvents() {
        AtomicInteger listener1Count = new AtomicInteger();
        AtomicInteger listener2Count = new AtomicInteger();

        RestSBEventListener listener1 = event -> {
            System.out.println("Event on Lsnr1: " + event);
            listener1Count.incrementAndGet();
            if (Integer.parseInt(event.getId()) == 8) {
                controller.cancelServerSentEvents(device1.deviceId());
            }
        };

        RestSBEventListener listener2 = event -> {
            listener2Count.incrementAndGet();
            System.out.println("Event on Lsnr2: " + event);
        };

        controller.addListener(listener1);
        controller.addListener(listener2);

        controller.startServerSentEvents(device1.deviceId(), "/testme/server-sent-events");

        controller.removeListener(listener1);
        controller.removeListener(listener2);

        assertEquals(9, listener1Count.get());
        assertEquals(9, listener2Count.get());
    }