function connect (secure, port) { var proto = secure ? 'https' : 'http' var opts = { rejectUnauthorized: false } return http2.connect(`${proto}://localhost:${port}`, opts) }
_connect() { this._session = http2.connect(this.url); this._session.setTimeout(this.options.connectTimeout, () => { const err = new Error('session#' + this.url + ' connect timeout(' + this.options.connectTimeout + 'ms)'); err.name = 'GRpcSessionConnectTimeoutError'; this.close(err); this.ready(err); }); this._session.once('close', () => { this._handleClose(); }); this._session.once('error', err => { this._handleSocketError(err); }); this._session.once('connect', () => { this._connected = true; this._session.setTimeout(0); const socket = this._session.socket; this._clientUrl = socket.localAddress + ':' + socket.localPort; this.ready(true); }); }
options.ca = this._config.tls_cert; const session = http2.connect(`https://${server_host}:${server_port}`, options); session.on('connect', resolve); this._stream = session.request({
const session = http2.connect(`https://${server_host}:${server_port}`, options); session.on('connect', resolve); this._stream = session.request({
const session = http2.connect(url); const stream = new CallStream(session, proto); const session = http2.connect(url); const stream = new CallStream(session, proto); ].forEach(errorCode => { it('should handle errorCode ' + errorCode, async function() { const session = http2.connect(url); const stream = new CallStream(session, proto);