enable proxy for Stripe HTTP connection#206
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Is it okay for PasswordAuthentication to return nil?
Author
There was a problem hiding this comment.
yes, the default impl is returning a null PasswordAuthentication. and i've verified.
scala> import java.net._
import java.net._
scala> import com.stripe._
import com.stripe._
scala> import com.stripe.model._
import com.stripe.model._
scala> val m = new java.util.HashMap[String, Object]
m: java.util.HashMap[String,Object] = {}
scala> m.put("description", "xbwu.enable.proxy.test")
res0: Object = null
scala> Stripe.apiKey="sk_test_..."
Stripe.apiKey: String = sk_test_...
scala> Stripe.setConnectionProxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("localhost", 3128)))
scala> Customer.create(m)
com.stripe.exception.APIConnectionException: IOException during API request to Stripe (https://api.stripe.com): Unable to tunnel through proxy. Proxy returns "HTTP/1.1 407 Proxy Authentication Required" Please check your internet connection and try again. If this problem persists,you should check Stripe's service status at https://twitter.com/stripestatus, or let us know at support@stripe.com.
scala> Stripe.setProxyCredential(new PasswordAuthentication("payment", "......".toCharArray))
scala> Customer.create(m)
res12: com.stripe.model.Customer =
<com.stripe.model.Customer@1074821682 id=cus_6pcgy8R2GZ0D7w> JSON: {......}
scala> Stripe.setProxyCredential(null)
scala> Stripe.setConnectionProxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("192.168.199.199", 3128)))
scala> Customer.create(m)
res29: com.stripe.model.Customer =
<com.stripe.model.Customer@589773472 id=cus_6pclJkgE5yM3N6> JSON: {......}
in my environment, localhost:3128 is tunneling to a proxy server which requires authorization, while 192.168.199.199:3128 is a proxy server doesn't need auth
Contributor
|
@xbwu Fantastic. |
kyleconroy
added a commit
that referenced
this pull request
Aug 21, 2015
enable proxy for Stripe HTTP connection
Author
|
thanks @kyleconroy, when should i expect new version being published to maven |
Contributor
|
@xbwu today or tomorrow. I'll ping here once it's released. |
Author
|
awesome, thanks @kyleconroy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
follow steps to tunnel Stripe connection through a proxy