Search in sources :

Example 6 with ProxySettings

use of com.microsoft.azure.sdk.iot.device.ProxySettings in project azure-iot-sdk-java by Azure.

the class ProxySettingsTest method getPortGetsPortFromAddress.

@Test
public void getPortGetsPortFromAddress() {
    // arrange
    final int expectedPort = 1234;
    new Expectations() {

        {
            mockProxy.address();
            result = mockInetSocketAddress;
            mockInetSocketAddress.getPort();
            result = expectedPort;
        }
    };
    ProxySettings proxySettings = new ProxySettings(mockProxy);
    // act
    int actualPort = proxySettings.getPort();
    // assert
    assertEquals(expectedPort, actualPort);
}
Also used : Expectations(mockit.Expectations) ProxySettings(com.microsoft.azure.sdk.iot.device.ProxySettings) Test(org.junit.Test)

Aggregations

ProxySettings (com.microsoft.azure.sdk.iot.device.ProxySettings)6 Test (org.junit.Test)6 HttpsMethod (com.microsoft.azure.sdk.iot.device.transport.https.HttpsMethod)2 HttpsRequest (com.microsoft.azure.sdk.iot.device.transport.https.HttpsRequest)2 Proxy (java.net.Proxy)2 URL (java.net.URL)2 Expectations (mockit.Expectations)2 InetSocketAddress (java.net.InetSocketAddress)1 IntegrationTest (tests.integration.com.microsoft.azure.sdk.iot.helpers.IntegrationTest)1