A whole bunch of changes to listener

Again, I apologize for the mass of changes. This was due to the delays in getting the committer agreement signed. In the future I will do as requested and submit a pull request for each issue.


.gitignore - just added more stuff to ignore

build.gradle - Set it up so it publishes a maven artifact both locally and remotely (the choice is set by the same property we used in core). So now folks can pull the listener down as its own maven dependency and publish locally. The later was incredibly useful during development. Got rid of javadocs because it doesn't work with Android. Added in wrapper support. These changes resolve issues #10, #12 & #13.

dependencies-archive.gradle - As discussed I switched the property for the version to be a gradle property rather than a system property.

gradle.properties - Sets the version & if the build should publish locally or remotely

gradlew, gradlew.bat & gradle directory - Set up a standard wrapper so we have a unified build environment that will work the same everywhere.

CBLAcceptor - This extends the acceptor interface from TJWS to add the ability to request a CBLSocketStatus object.

CBLHTTPServer - Extends to allow users to directly submit TJWS properties (needed to do things like set up SSL support) as well as an authorization object (used by Core). It also will set up the CBLSimpleAcceptor by default, this is the same as the default TJWS acceptor except it supports the CBLAcceptor interface. Also adds a call getSocketStatus to get a CBLSocketStatus object that allows one to discover things like what port is being used, the status of the connection, etc.

CBLHTTPServlet - Some header cleanup and as discussed I moved the server object and authorization object into the constructor instead of using properties. Also added logic to configure the SSLSession property when we detect that SSL is being used.

CBLListener - Got rid of the code to hunt for available ports, now one can just submit port 0. Extended constructor to support TJWS properties and the authorization object. Per our conversation got rid of server status because it isn't actually useful. Put in a hook to get socket status which is useful.

CBLSSLAcceptor - An extension of TJWS's SSLAcceptor to support the CBLAcceptor interface so we can publish socket information. Also put in some logic to use ARG_PORT and ARG_BINDADDRESS. For historical reasons TJWS uses different properties in SSL for these values which confused me to death. So my little hack bridges the values together so you can use either and get the right result.

CBLSimpleAcceptor - This is unfortunately a complete copy and paste of the TJWS simple acceptor (with copyright). The reason is that the socket value in simple acceptor (unlike, for some reason, the ssl acceptor) is private, not protected. So unless I used reflection I couldn't get to it. So I just copied the code and added CBLAcceptor support.

CBLSocketStatus - This provides information on the listener's underlying socket. Besides letting you find out what port is being used, it provides lots of other information that was really useful during debugging. Note that I explicitly used CBLSocketStatus rather than exposing ServerSocket so as to only provide 'safe' readonly interfaces.
  
       Thanks,

                Yaron



Old Note:
I am working with listener in Android 0.3.0 which has fully embraced Gradle. To make this work nicely with listener just requires the changes below. The only major change is that I pulled UPLOAD_VERSION_CBLITE out of system environment and instead made it a Gradle property. I then set that property in gradle.properties. Note btw that checking in the other Gradle artifacts is intentional (as specified in the Gradle docs) since it makes sure everyone builds in the same environment.

The benefit of this work is two fold:
1) Everyone builds in exactly the same way so we have reproducibility
2) You can use file->import project, point at build.gradle and it 'just works' in Android Studio 0.3.0 which is really, really nice.

Thoughts? Is this a reasonable change?

        Thanks,

                 Yaron