@Override
    protected void intercept(@NonNull HttpRequestChain chain, @NonNull ByteBuffer buffer,
                             int index) throws IOException {
        if (index == 0) {
            if (SSLWhiteList.contains(chain.request().ip())) {
                mType = TYPE_WHITELIST;
                NetBareLog.i("detect whitelist ip " + chain.request().ip());
            } else {
                mType = chain.request().host() == null ? TYPE_INVALID : verifyHttpType(buffer);
            }
        }
        if (mType == TYPE_HTTPS) {
            mSession.isHttps = true;
        }
        if ((mType == TYPE_INVALID) || (mType == TYPE_WHITELIST)) {
            chain.processFinal(buffer);
            return;
        }
        chain.process(buffer);
    }
A fronted interceptor verifies the first net packet in order to determine whether it is a HTTP
protocol packet. If the packet is not a valid HTTP packet, it will be sent to tunnel directly,
otherwise sent to the next interceptor.

@author Megatron King
@since 2018-12-04 11:58
netbare-core/src/main/java/com/github/megatronking/netbare/http/HttpSniffInterceptor.java