@Override
    public void setControllers(List<ControllerInfo> controllers) {
        DeviceId deviceId = getDeviceId();
        checkNotNull(deviceId, MSG_DEVICE_ID_NULL);

        MastershipService mastershipService = getHandler().get(MastershipService.class);
        checkNotNull(mastershipService, MSG_MASTERSHIP_NULL);

        if (!mastershipService.isLocalMaster(deviceId)) {
            log.warn(
                "I am not master for {}. " +
                "Please use master {} to set controllers for this device",
                deviceId, mastershipService.getMasterFor(deviceId));
            return;
        }

        ObjectMapper mapper = new ObjectMapper();

        // Create the object node to host the data
        ObjectNode sendObjNode = mapper.createObjectNode();

        // Insert header
        ArrayNode ctrlsArrayNode = sendObjNode.putArray(PARAM_CTRL);

        // Add each controller's information object
        for (ControllerInfo ctrl : controllers) {
            ObjectNode ctrlObjNode = mapper.createObjectNode();
            ctrlObjNode.put(PARAM_CTRL_IP,   ctrl.ip().toString());
            ctrlObjNode.put(PARAM_CTRL_PORT, ctrl.port());
            ctrlObjNode.put(PARAM_CTRL_TYPE, ctrl.type());
            ctrlsArrayNode.add(ctrlObjNode);
        }

        // Post the controllers to the device
        int response = getController().post(
            deviceId, URL_CONTROLLERS_SET,
            new ByteArrayInputStream(sendObjNode.toString().getBytes()), JSON);

        if (!checkStatusCode(response)) {
            log.error("Failed to set controllers on device {}", deviceId);
        }

        return;
    }
@Test
    public void testSetControllers() {
        // Get device handler
        DriverHandler driverHandler = null;
        try {
            driverHandler = driverService.createHandler(restDeviceId1);
        } catch (Exception e) {
            throw e;
        }
        assertThat(driverHandler, notNullValue());

        // TODO: Fix this test
    }