@NonNull
    public Session ensureQuery(Protocol protocol, short localPort, short remotePort, int remoteIp) {
        Session session = mSessions.get(localPort);
        if (session != null) {
            if (session.protocol != protocol || session.localPort != localPort ||
                    session.remotePort != remotePort || session.remoteIp != remoteIp) {
                session = null;
            }
        }
        if (session == null) {
            session = new Session(protocol, localPort, remotePort, remoteIp);
            mSessions.put(localPort, session);
            // Dump uid from /proc/net/
            if (mDumper != null) {
                mDumper.request(session);
            }
        }
        return session;
    }
Query or create a session by protocol, ports and remote server IP.

@param protocol IP protocol.
@param localPort Local VPN port.
@param remotePort Remote server port.
@param remoteIp Remote server IP.
@return An instance of {@link Session}, if the instance not exists, will create a new one.
netbare-core/src/main/java/com/github/megatronking/netbare/net/SessionProvider.java