Tabnine Logo
OperationContext.setProxy
Code IndexAdd Tabnine to your IDE (free)

How to use
setProxy
method
in
com.microsoft.azure.storage.OperationContext

Best Java code snippets using com.microsoft.azure.storage.OperationContext.setProxy (Showing top 4 results out of 315)

origin: apache/nifi

  public static void setProxy(final OperationContext operationContext, final ProcessContext processContext) {
    final ProxyConfiguration proxyConfig = ProxyConfiguration.getConfiguration(processContext);
    operationContext.setProxy(proxyConfig.createProxy());
  }
}
origin: iterate-ch/cyberduck

context.setProxy(socksProxy);
break;
context.setProxy(httpProxy);
break;
origin: Azure/azure-storage-android

@Test
public void testProxy() throws URISyntaxException, StorageException {
  CloudBlobClient blobClient = TestHelper.createCloudBlobClient();
  CloudBlobContainer container = blobClient.getContainerReference("container1");
  // Use a request-level proxy
  OperationContext opContext = new OperationContext();
  opContext.setProxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("10.1.1.1", 8888)));
  // Turn of retries to make the failure happen faster
  BlobRequestOptions opt = new BlobRequestOptions();
  opt.setRetryPolicyFactory(new RetryNoRetry());
  // Unfortunately HttpURLConnection doesn't expose a getter and the usingProxy method it does have doesn't
  // work as one would expect and will always for us return false. So, we validate by making sure the request
  // fails when we set a bad proxy rather than check the proxy setting itself.
  try {
    container.exists(null, opt, opContext);
    fail("Bad proxy should throw an exception.");
  } catch (StorageException e) {
    if (e.getCause().getClass() != ConnectException.class &&
        e.getCause().getClass() != SocketTimeoutException.class &&
        e.getCause().getClass() != SocketException.class) {
      Assert.fail("Unepected exception for bad proxy");
    }
  }
}
origin: Azure/azure-storage-android

@Test
public void testProxyOverridesDefault() throws URISyntaxException, StorageException {
  CloudBlobClient blobClient = TestHelper.createCloudBlobClient();
  CloudBlobContainer container = blobClient.getContainerReference("container1");
  // Set a default proxy
  OperationContext.setDefaultProxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("10.1.1.1", 8888)));
  // Turn off retries to make the failure happen faster
  BlobRequestOptions opt = new BlobRequestOptions();
  opt.setRetryPolicyFactory(new RetryNoRetry());
  // Unfortunately HttpURLConnection doesn't expose a getter and the usingProxy method it does have doesn't
  // work as one would expect and will always for us return false. So, we validate by making sure the request
  // fails when we set a bad proxy rather than check the proxy setting itself succeeding.
  try {
    container.exists(null, opt, null);
    fail("Bad proxy should throw an exception.");
  } catch (StorageException e) {
    if (e.getCause().getClass() != ConnectException.class &&
        e.getCause().getClass() != SocketTimeoutException.class) {
      Assert.fail("Unepected exception for bad proxy");
    }
  }
  // Override it with no proxy
  OperationContext opContext = new OperationContext();
  opContext.setProxy(Proxy.NO_PROXY);
  // Should succeed as request-level proxy should override the bad default proxy
  container.exists(null, null, opContext);
}
com.microsoft.azure.storageOperationContextsetProxy

Javadoc

Sets a proxy which will be used when making a request. Default is null. To set a proxy to use by default, use #setDefaultProxy

Popular methods of OperationContext

  • <init>
    Creates an instance of the OperationContext class.
  • getSendingRequestEventHandler
    Gets an event multi-caster that is triggered before sending a request. It allows event listeners to
  • getResponseReceivedEventHandler
    Gets an event multi-caster that is triggered when a response is received. It allows event listeners
  • getErrorReceivingResponseEventHandler
    Gets an event multi-caster that is triggered when a network error occurs before the HTTP response st
  • getRequestResults
    Returns the set of request results that the current operation has created.
  • setUserHeaders
    Sets any additional headers for the request, for example, for proxy or logging information.
  • getClientRequestID
    Gets the client side trace ID.
  • getGlobalErrorReceivingResponseEventHandler
    Gets a global event multi-caster that is triggered when a network error occurs before the HTTP respo
  • getGlobalRequestCompletedEventHandler
    Gets a global event multi-caster that is triggered when a request is completed. It allows event list
  • getGlobalResponseReceivedEventHandler
    Gets a global event multi-caster that is triggered when a response is received. It allows event list
  • getGlobalRetryingEventHandler
    Gets a global event multi-caster that is triggered when a request is retried. It allows event listen
  • getGlobalSendingRequestEventHandler
    Gets a global event multi-caster that is triggered before sending a request. It allows event listene
  • getGlobalRetryingEventHandler,
  • getGlobalSendingRequestEventHandler,
  • getRequestCompletedEventHandler,
  • getRetryingEventHandler,
  • setDefaultProxy,
  • appendRequestResult,
  • getDefaultProxy,
  • getLastResult,
  • getProxy

Popular in Java

  • Finding current android device location
  • onCreateOptionsMenu (Activity)
  • getResourceAsStream (ClassLoader)
  • onRequestPermissionsResult (Fragment)
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • JOptionPane (javax.swing)
  • Runner (org.openjdk.jmh.runner)
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now