Based on earlier feedback, I have a revised set of HTTP stack
integrations for NetCipher:

https://commonsware.com/misc/HTTPStacks.zip

I added a higher-level API over top of what I had previously. To get a
NetCipher-enabled connection, if Orbot is already installed, you need to
do three things:

1. Call OrbotInitializer.get(this).init(); from onCreate() of a custom
Application subclass. Or, initialize the singleton somewhere else, if
you prefer. 

2. Create an appropriate builder, such as StrongConnectionBuilder for
HttpURLConnection. The one-liner for this is to call the
forMaxSecurity() static method on the builder class:

StrongConnectionBuilder
builder=StrongConnectionBuilder.forMaxSecurity(ctxt);

(where ctxt is a Context)

3. Call build() on the builder, passing a Callback<> object, whose
generic type is based on the builder (e.g., StrongConnectionBuilder uses
Callback<HttpURLConnection>). The big method is onConnected(), where you
are passed the configured connection (e.g., HttpURLConnection) that you
can use. There is also onConnectionException() and onTimeout() in case
we run into problems setting up the connection:

builder.build(
  new StrongBuilder.Callback<HttpURLConnection>() {
    @Override
    public void onConnected(HttpURLConnection c) {
      // TODO
    }

    @Override
    public void onConnectionException(IOException e) {
      // TODO
    }

    @Override
    public void onTimeout() {
      // TODO
    }
});

In addition, this update includes:

- SNI support for all stacks
- SOCKS proxy support for everything but OkHttp3, due to limitations in
OkHttp3
- other improvements to the lower-level API, such as handling all of the
Orbot statuses (OFF/STARTING/ON/STOPPING)

I'll be revamping my book chapter based upon this update; I'll make a
copy of that available when it is ready.

-- 
Mark Murphy (a Commons Guy)
https://commonsware.com | https://github.com/commonsguy
https://commonsware.com/blog | https://twitter.com/commonsguy
_______________________________________________
List info: https://lists.mayfirst.org/mailman/listinfo/guardian-dev
To unsubscribe, email:  [email protected]

Reply via email to