All files / src/Ice Connection.js

92.3% Statements 72/78
91.66% Branches 11/12
90.9% Functions 10/11
92.3% Lines 72/78

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 7941x 41x 41x 41x 41x 41x 41x 481x 481x 481x 481x 481x         481x 41x 41x 478x 478x 41x 41x 1x 1x 41x 41x     41x 41x 41x 41x 41x 41x 41x 481x 481x 481x 481x 481x 481x 41x 41x 480x 480x 41x 41x 480x 480x 41x 41x 480x 480x 41x 41x 480x 480x 41x 41x 41x 41x 41x 41x 41x 481x 481x 481x 41x 41x 1x 1x 41x 41x 41x 41x 41x 41x  
// Copyright (c) ZeroC, Inc.
 
/**
 *  Base class providing access to the connection details.
 */
export class ConnectionInfo {
    constructor(underlying, adapterName, connectionId) {
        if (underlying === null) {
            this._underlying = null;
            this._adapterName = adapterName;
            this._connectionId = connectionId;
        } else {
            this._underlying = underlying;
            this._adapterName = underlying.adapterName;
            this._connectionId = underlying.connectionId;
        }
    }
 
    get underlying() {
        return this._underlying;
    }
 
    get adapterName() {
        return this._adapterName;
    }
 
    get connectionId() {
        return this._connectionId;
    }
}
 
/**
 *  Provides access to the connection details of an IP connection
 */
export class IPConnectionInfo extends ConnectionInfo {
    constructor(adapterName, connectionId, localAddress, localPort, remoteAddress, remotePort) {
        super(null, adapterName, connectionId);
        this._localAddress = localAddress;
        this._localPort = localPort;
        this._remoteAddress = remoteAddress;
        this._remotePort = remotePort;
    }
 
    get localAddress() {
        return this._localAddress;
    }
 
    get localPort() {
        return this._localPort;
    }
 
    get remoteAddress() {
        return this._remoteAddress;
    }
 
    get remotePort() {
        return this._remotePort;
    }
}
 
/**
 *  Provides access to the connection details of a TCP connection
 */
export class TCPConnectionInfo extends IPConnectionInfo {
    constructor(adapterName, connectionId, localAddress, localPort, remoteAddress, remotePort, sndSize) {
        super(adapterName, connectionId, localAddress, localPort, remoteAddress, remotePort);
        this._sndSize = sndSize;
    }
 
    get sndSize() {
        return this._sndSize;
    }
}
 
/**
 *  Provides access to the connection details of a WebSocket connection
 */
export class WSConnectionInfo extends ConnectionInfo {}