TLS Server Name Indication(SNI) support

Added server side support for TLS SNI. With SNI, we can add multiple host names on a single secure server. The server will check hostname extension of TLS client hello, and wrap/unwrap the connection with proper certificate.

SNI is supported in a new class SniSslHandler extends SslHandler, with a map of String:SSLEngine as argument. You can use glob express like "*.leancloud,cn" as key to match all requests to the domain (as certificate supports that).

Tested on:

* Nodejs 0.10.x: support SNI,  works
* python2 urllib: doesn't send SNI, don't verify server host name in server hello
* python3 urllib: support SNI, works
* Apache HttpComponents on openjdk8: doesn't send SNI, and check server host name


That is what I mean :)

> Am 30.10.2014 um 04:36 schrieb Scott Mitchell <notifications@github.com>:
> 
> In handler/src/main/java/io/netty/handler/ssl/SniSslHandler.java:
> 
> > +     */
> > +    public SniSslHandler(Map<String, SSLEngine> engines, SSLEngine defaultEngine) {
> > +        super(defaultEngine);
> > +        this.engines = engines;
> > +
> > +        handshaken = false;
> > +    }
> > +
> > +    /**
> > +     * <p>Simple function to match <a href="http://en.wikipedia.org/wiki/Wildcard_DNS_record">DNS wildcard.</a>
> > +     * </p>
> > +     *
> > +     * <p><code>*.netty.io</code> will match both <code>netty.io</code> and <code>downloads.netty.io</code></p>
> > +     */
> > +    private static boolean matches(String hostNameTemplate, String hostName) {
> > +        if (hostNameTemplate.startsWith("*.")) {
> @sunng87 - Perhaps make a Pattern object a private static member of the class? It is possible (and likely) that 1 server (or really 1 JVM) will accept multiple connections (possibly all using SNI) within its execution time right?
> 
> —
> Reply to this email directly or view it on GitHub.