Search in sources :

Example 1 with IotHubNotFoundException

use of com.microsoft.azure.sdk.iot.service.exceptions.IotHubNotFoundException in project azure-iot-sdk-java by Azure.

the class DeviceMethodIT method invokeMethod_resetDevice_failed.

@Test
public void invokeMethod_resetDevice_failed() throws Exception {
    // Arrange
    TestDevice testDevice = devices.get(0);
    // Act
    try {
        MethodResult result = methodServiceClient.invoke(testDevice.getDeviceId(), METHOD_RESET, RESPONSE_TIMEOUT, CONNECTION_TIMEOUT, null);
        testDevice.restartDevice();
        throw new Exception("Reset device do not affect the method invoke on the service");
    } catch (IotHubNotFoundException expected) {
    // Don't do anything, expected throw.
    }
    testDevice.restartDevice();
}
Also used : IotHubNotFoundException(com.microsoft.azure.sdk.iot.service.exceptions.IotHubNotFoundException) URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException) IotHubGatewayTimeoutException(com.microsoft.azure.sdk.iot.service.exceptions.IotHubGatewayTimeoutException) SocketTimeoutException(java.net.SocketTimeoutException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) IotHubException(com.microsoft.azure.sdk.iot.service.exceptions.IotHubException) IotHubNotFoundException(com.microsoft.azure.sdk.iot.service.exceptions.IotHubNotFoundException) MethodResult(com.microsoft.azure.sdk.iot.service.devicetwin.MethodResult) Test(org.junit.Test)

Aggregations

MethodResult (com.microsoft.azure.sdk.iot.service.devicetwin.MethodResult)1 IotHubException (com.microsoft.azure.sdk.iot.service.exceptions.IotHubException)1 IotHubGatewayTimeoutException (com.microsoft.azure.sdk.iot.service.exceptions.IotHubGatewayTimeoutException)1 IotHubNotFoundException (com.microsoft.azure.sdk.iot.service.exceptions.IotHubNotFoundException)1 IOException (java.io.IOException)1 SocketTimeoutException (java.net.SocketTimeoutException)1 URISyntaxException (java.net.URISyntaxException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 Test (org.junit.Test)1