use of com.microsoft.azure.sdk.iot.device.transport.HttpProxySocketFactory in project azure-iot-sdk-java by Azure.
the class HttpsConnectionTest method setSSLContextSetsContextWithProxy.
@Test
public void setSSLContextSetsContextWithProxy(@Mocked final SSLContext mockedContext, @Mocked final SSLSocketFactory mockedSocketFactory, @Mocked final HttpProxySocketFactory mockedHttpProxySocketFactory) throws IOException, TransportException {
final HttpsMethod httpsMethod = HttpsMethod.POST;
new NonStrictExpectations() {
{
mockUrl.getProtocol();
result = "https";
mockUrl.openConnection();
result = mockUrlConn;
mockUrlConn.getRequestMethod();
result = httpsMethod.name();
mockedContext.getSocketFactory();
result = mockedSocketFactory;
new HttpProxySocketFactory(mockedSocketFactory, mockProxySettings);
result = mockedHttpProxySocketFactory;
}
};
final HttpsConnection conn = new HttpsConnection(mockUrl, httpsMethod, mockProxySettings);
Deencapsulation.invoke(conn, "setSSLContext", mockedContext);
new Verifications() {
{
mockUrlConn.setSSLSocketFactory(mockedHttpProxySocketFactory);
times = 1;
}
};
}
Aggregations