@Test public void testGetMaxAutoReconnectAttempts() throws Exception { AWSIotMqttManager testClient = new AWSIotMqttManager("test-client", Region.getRegion(Regions.US_EAST_1), TEST_ENDPOINT_PREFIX); assertEquals(10, testClient.getMaxAutoReconnectAttempts()); }
@Test public void testSetMaxAutoReconnectAttemptsForever() throws Exception { AWSIotMqttManager testClient = new AWSIotMqttManager("test-client", Region.getRegion(Regions.US_EAST_1), TEST_ENDPOINT_PREFIX); testClient.setMaxAutoReconnectAttepts(-1); // -1 = retry forever assertEquals(-1, testClient.getMaxAutoReconnectAttempts()); }
@Test(expected = IllegalArgumentException.class) public void testSetMaxAutoReconnectAttemptsIllegalValue() throws Exception { AWSIotMqttManager testClient = new AWSIotMqttManager("test-client", Region.getRegion(Regions.US_EAST_1), TEST_ENDPOINT_PREFIX); testClient.setMaxAutoReconnectAttepts(-5); assertEquals(6, testClient.getMaxAutoReconnectAttempts()); }
@Test public void testSetMaxAutoReconnectAttempts() throws Exception { AWSIotMqttManager testClient = new AWSIotMqttManager("test-client", Region.getRegion(Regions.US_EAST_1), TEST_ENDPOINT_PREFIX); testClient.setMaxAutoReconnectAttepts(5); assertEquals(5, testClient.getMaxAutoReconnectAttempts()); }
@Test public void testCreateClientWithEndpoint() throws Exception { AWSIotMqttManager testClient = new AWSIotMqttManager("test-client", "ABCDEFG.iot.us-east-1.amazonaws.com"); assertEquals(true, testClient.isAutoReconnect()); assertEquals(4, testClient.getReconnectTimeout()); assertEquals(4, testClient.getMinReconnectRetryTime()); assertEquals(64, testClient.getMaxReconnectRetryTime()); assertEquals(10, testClient.getMaxAutoReconnectAttempts()); assertEquals(300, testClient.getKeepAlive()); assertEquals(10, testClient.getConnectionStabilityTime()); assertTrue(testClient.isOfflinePublishQueueEnabled()); assertEquals(100L, (long)testClient.getOfflinePublishQueueBound()); assertEquals(Region.getRegion(Regions.US_EAST_1), testClient.getRegion()); assertEquals(MqttManagerConnectionState.Disconnected, testClient.getConnectionState()); }
assertEquals(4, testClient.getMinReconnectRetryTime()); assertEquals(64, testClient.getMaxReconnectRetryTime()); assertEquals(10, testClient.getMaxAutoReconnectAttempts()); assertEquals(300, testClient.getKeepAlive()); assertEquals(10, testClient.getConnectionStabilityTime()); assertEquals(64, testClient.getMinReconnectRetryTime()); assertEquals(128, testClient.getMaxReconnectRetryTime()); assertEquals(5, testClient.getMaxAutoReconnectAttempts()); assertEquals(20, testClient.getKeepAlive()); assertEquals(25, testClient.getConnectionStabilityTime());