protected override TLSConnection CreateConnection(INetSession session, Socket acceptSocket) { TLSWSConnection wsConnection = ( TLSWSConnection )base.CreateConnection(session, acceptSocket); wsConnection.subProtocols = this._subProtocols; return(wsConnection); }
protected NetSession(uint id, ProtoType type, X509Certificate2 certificate) { this.id = id; switch (type) { case ProtoType.TCP: if (certificate != null) { TLSConnection tlsConnection; this.connection = tlsConnection = new TLSConnection(this); tlsConnection.certificate = certificate; } else { this.connection = new TCPConnection(this); } break; case ProtoType.WebSocket: if (certificate != null) { TLSWSConnection tlsWSConnection; this.connection = tlsWSConnection = new TLSWSConnection(this); tlsWSConnection.certificate = certificate; } else { this.connection = new WSConnection(this); } break; case ProtoType.KCP: this.connection = new KCPConnection(this); break; default: throw new NotSupportedException(); } }