All Implemented Interfaces:
ActionListener

public class Tcpbw100extends JApplet implements ActionListener
Main Applet class that creates UI, defines tests and interprets results from the tests.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    private class 
    Timer base for periodic NDT phases.
    (package private) class 
    Class to start tests in a thread.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) boolean
    Set when the current test run failed.
    (package private) boolean
    Set when the client is a native application rather than a browser.
    private final AtomicBoolean
    True while a bandwidth test is running.
    (package private) JButton
    Button details.
    (package private) JButton
    Button start test.
    (package private) JButton
    Button statistics.
    (package private) int
    How often, in ms, the down and up speed displays are refreshed.
    (package private) JCheckBox
    Chkbox default test.
    (package private) JCheckBox
    Chkbox default test.
    private final I2PAppContext
    The app context.
    (package private) double
    Measured speeds: server-to-client, client-to-server, and their slow-start phases.
    private String
    Status text shown in the applet.
    (package private) double
    Measured speeds: server-to-client, client-to-server, and their slow-start phases.
    (package private) double
    Total bytes sent by the server.
    (package private) double
    Measured speeds: server-to-client, client-to-server, and their slow-start phases.
    (package private) double
    Measured speeds: server-to-client, client-to-server, and their slow-start phases.
    (package private) double
    Elapsed test time in seconds.
    (package private) NewFrame
    Frame web100 vars.
    (package private) NewFrame
    Frame web100 vars.
    (package private) int
    Data packets out, socket buffer sizes, and ACKs in.
    (package private) int
    Congestion-control state: fast retransmits, ACKs out, smoothed RTT, and congestion window.
    (package private) int
    Message counts: client-to-server data and ACKs, server-to-client data and ACKs.
    (package private) int
    Message counts: client-to-server data and ACKs, server-to-client data and ACKs.
    (package private) int
    Middlebox (firewall) verdict for the client-to-server test.
    (package private) int
    Packets out, congestion signals, and receive-window scale.
    (package private) int
    RTT totals and counts, current MSS, timeouts, and retransmitted packets.
    (package private) int
    Congestion-control state: fast retransmits, ACKs out, smoothed RTT, and congestion window.
    (package private) int
    RTT totals and counts, current MSS, timeouts, and retransmitted packets.
    (package private) int
    Packet count, buffer length, and current retransmission timeout.
    (package private) long
    Total data bytes sent to the client.
    (package private) int
    Data packets out, socket buffer sizes, and ACKs in.
    (package private) int
    SACKs received, duplicate ACKs in, and max receive window sent and received.
    (package private) int
    TCP feature flags: ECN, Nagle, and the MSS sent and received.
    (package private) int
    Congestion-control state: fast retransmits, ACKs out, smoothed RTT, and congestion window.
    (package private) int
    Packet count, buffer length, and current retransmission timeout.
    (package private) int
    Congestion-control state: fast retransmits, ACKs out, smoothed RTT, and congestion window.
    (package private) int
    SACKs received, duplicate ACKs in, and max receive window sent and received.
    (package private) int
    SACKs received, duplicate ACKs in, and max receive window sent and received.
    (package private) int
    Send-limited transfer counts for rwin, cwnd, and sender, plus max slow-start threshold.
    (package private) int
    TCP feature flags: ECN, Nagle, and the MSS sent and received.
    (package private) int
    Packet count, buffer length, and current retransmission timeout.
    (package private) int
    Packets out, congestion signals, and receive-window scale.
    (package private) int
    RTT totals and counts, current MSS, timeouts, and retransmitted packets.
    (package private) int
    Data packets out, socket buffer sizes, and ACKs in.
    (package private) int
    Packets out, congestion signals, and receive-window scale.
    (package private) int
    Message counts: client-to-server data and ACKs, server-to-client data and ACKs.
    (package private) int
    Message counts: client-to-server data and ACKs, server-to-client data and ACKs.
    (package private) int
    Middlebox (firewall) verdict for the server-to-client test.
    (package private) int
    TCP feature flags: SACK, timestamps, and window scaling sent and received.
    (package private) int
    SACKs received, duplicate ACKs in, and max receive window sent and received.
    (package private) int
    Congestion-control state: fast retransmits, ACKs out, smoothed RTT, and congestion window.
    (package private) int
    Data packets out, socket buffer sizes, and ACKs in.
    (package private) int
    Seconds spent send-limited by receive window, congestion window, and sender.
    (package private) int
    Seconds spent send-limited by receive window, congestion window, and sender.
    (package private) int
    Seconds spent send-limited by receive window, congestion window, and sender.
    (package private) int
    Send-limited transfer counts for rwin, cwnd, and sender, plus max slow-start threshold.
    (package private) int
    Send-limited transfer counts for rwin, cwnd, and sender, plus max slow-start threshold.
    (package private) int
    Send-limited transfer counts for rwin, cwnd, and sender, plus max slow-start threshold.
    (package private) int
    Server send-queue length.
    (package private) int
    RTT totals and counts, current MSS, timeouts, and retransmitted packets.
    (package private) int
    RTT totals and counts, current MSS, timeouts, and retransmitted packets.
    (package private) int
    TCP feature flags: SACK, timestamps, and window scaling sent and received.
    (package private) int
    TCP feature flags: SACK, timestamps, and window scaling sent and received.
    (package private) int
    TCP feature flags: SACK, timestamps, and window scaling sent and received.
    private Locale
    Locale selected for the test display.
    private final Log
    Logger for the test.
    Bundle of translated test messages.
    (package private) ResultsTextPane
    Results txt pane.
    (package private) int
    How often, in ms, the down and up speed displays are refreshed.
    (package private) String[]
    Sa delays.
    private String
    Client type reported to the test server.
    private String
    Country code for the display messages.
    (package private) String
    Error message shown when a test fails.
    private String
    Parameter telling the applet to run automatically.
    private String
    Language code for the display messages.
    private StatusPanel
    Panel showing the test status.
    (package private) JSpinner
    Spinner test count.
    (package private) String
    Server flavour, "web100" or "web10g", selects which messages the server understands.
    private final I2PSSLSocketFactory
    Factory for the SSL test sockets.
    (package private) String
    Accumulated human-readable test results and diagnostics.
    private String
    Browser user agent string, if supplied.
    private ThreadGroup
    Thread group holding the test threads.
    (package private) JTextArea
    Txt diagnosis.
    (package private) JTextArea
    Txt diagnosis.
    private final boolean
    Whether the test connects over SSL.
    (package private) byte[]
    Scratch buffer for writing test data to the client.
    (package private) byte
    Bit mask of the tests to run: C2S, S2C, status and meta.
    (package private) double
    Achievable speed.
    (package private) double
    Packet loss rate.
    (package private) int
    Half duplex.
    (package private) int
    Half duplex.
    (package private) double
    Packet ordering metric.
    (package private) double
    Packet ordering metric.
    (package private) double
    Packet loss rate.
    (package private) int
    Half duplex.
    (package private) InetAddress
    Host address.
    private boolean
    Whether the server supports JSON results.
    (package private) double
    Packet loss rate.
    (package private) int
    Half duplex.
    (package private) int
    TCP feature flags: ECN, Nagle, and the MSS sent and received.
    (package private) int
    TCP feature flags: ECN, Nagle, and the MSS sent and received.
    (package private) double
    Measured link speed.
    (package private) double
    Packet ordering metric.
    private String
    Client access technology, such as cable or DSL.
    private double
    Average round trip time during the test, in ms.
    private int
    Flag for a bad cable modem condition.
    private long
    Bytes transferred during the test.
    private double
    Upload speed from client to server, in Kbps.
    private String
    Client IP address as seen by the server.
    private int
    Flag for network congestion during the test.
    private int
    Current retransmission timeout during the test.
    private int
    Current receive window advertised by the server.
    private double
    Share of the test spent in congestion window growth.
    private String
    Diagnosis of what limited the test result.
    private int
    Duplicate acknowledgements received during the test.
    private int
    Duplicate acknowledgements sent during the test.
    private String
    Error message from the test, if it failed.
    private String
    Client host name reported to the server.
    private double
    Packet loss during the test, as a fraction.
    private int
    Longest retransmission timeout during the test.
    private int
    Longest round trip time during the test, in ms.
    private int
    Largest receive window advertised by the server.
    private int
    Shortest retransmission timeout during the test.
    private int
    Shortest round trip time during the test, in ms.
    private int
    Flag for a client-server version mismatch.
    private String
    Client NAT box type reported by the plugin.
    private String
    Client OS architecture reported to the server.
    private String
    Client OS name reported to the server.
    private String
    Client OS version reported by the plugin.
    private double
    Share of the test limited by the receiver.
    private String
    Client plugin version reported to the server.
    private double
    Download speed from server to client, in Kbps.
    private int
    Selective acknowledgements received during the test.
    private String
    Test statistics formatted for display.
    private String
    Status string shown to the test UI.
    private double
    Elapsed time of the test, in seconds.
    private int
    Retransmission timeouts during the test.
    private Date
    When the test finished.
    private boolean
    Whether to retry a failed test.
    (package private) double
    Packet loss rate.
    (package private) double
    Packet ordering metric.
    (package private) double
    Packet ordering metric.
    (package private) double
    Packet ordering metric.
    private static final long
    Compiler generated UID that does not follow naming convention, and is not related to functionality itself.
    (package private) String
    Server host name used for the test.
    (package private) double
    Packet loss rate.
    (package private) double
    Packet ordering metric.
    (package private) double
    Packet loss rate.
    (package private) double
    Packet loss rate.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Tcpbw100(boolean useSSL)
    Tcpbw100.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Action handler method called when an associated action is performed.
    void
    Create the "More details" window.
    private void
    Initialize the "main" window.
    void
    Create the "Statistics" window.
    void
    Method to run tests and interpret the results sent by the server.
    Returns the access technology the server detected for the link.
    Returns the average round trip time the server reported, in milliseconds.
    Reports whether the server flagged the link as a bad cable.
    Measured upload (client-to-server) speed as a plain decimal string.
    Returns the client address the server saw, as text.
    Reports whether the server flagged congestion on the link.
    Returns the current retransmission timeout the server reported, in milliseconds.
    Returns the current TCP receive window the server reported, in bytes.
    Returns the fraction of the run limited by the congestion window.
    Returns the diagnosis text left behind by the most recent run.
    Returns the count of duplicate acknowledgements the client received.
    Returns the count of duplicate acknowledgements the client sent.
    Returns the error text left behind by the most recent run.
    Returns the host name this applet is pointed at.
    Returns the speed measured since the last sample, in bits per millisecond.
    Returns the spread between the largest and smallest round trip times, in milliseconds.
    Returns the packet loss the server reported, as a fraction from 0 to 1.
    Returns the largest round trip time the server reported, in milliseconds.
    Returns the largest receive window the server reported, in bytes.
    Reports whether the server saw a speed mismatch between the two directions.
    Returns the NAT type the server detected for this client.
    Suggests a receive buffer size in KiB, derived from the largest window seen.
    Returns the operating system architecture the client reported.
    Returns the operating system name the client reported.
    Returns the operating system version the client reported.
    Returns the throughput ceiling the receive window over round trip time sets.
    Returns the minimum round trip time the server reported, in milliseconds.
    Returns the plugin version the client reported.
    Returns the percentage of the run the receive buffer was too small.
    Measured download (server-to-client) speed as a plain decimal string.
    Returns the count of selective acknowledgement packets the client received.
    Returns the statistics summary left behind by the most recent run.
    Returns the current run state, notStarted until a test begins.
    Returns the clock stamp the server sent, or the word unknown when absent.
    Estimates the stall time in seconds from the current timeout and its count.
    int
    Get Client->Server fire-wall test results.
    getNDTvar(String varName)
    Function that returns a variable corresponding to the parameter passed to it as a request.
    getParameter(String paramStrName)
    Utility method to get parameter value.
    int
    Get Server->Client fire-wall test results.
    I2P Translated status, not HTML escaped.
    Set UserAgent String containing browser details.
    void
    Initialize the base NDT window Applet init() method.
    boolean
    Reports whether a test run is currently in progress.
    private boolean
    isValueSave(String sSysvarParam)
    Check if the given key is one whose value is saved by save_int_values(String, int), save_dbl_values(), or save_long_values().
    void
    Stop the test and kill its thread group.
    static void
    main(String[] args)
    Public static void main for invoking as an Application.
    static Tcpbw100
    Builds and shows the applet in a 700x320 window from the command line.
    private Socket
    newSocket(InetAddress hostAddress, int ctlPort)
    Return a SSL or standard socket depending on config.
    private int
    Parse a message body string to an integer using base 10.
    private int
    parseMsgBodyToInt(String msg, int radix)
    Parse a message body string to an integer using the given radix.
    void
    "Remote Control" function - invoke NDT' runtest() method from the API.
    void
    Runs the configured tests on a daemon thread in a private daemon thread group, so an uncaught error is logged rather than reaching the default handler.
    void
    Run the Thread that calls the "dottcp" method to run tests.
    void
    save_dbl_values(String sSysvarParam, double dSysvalParam)
    Save double values of various keys from the test results string.
    void
    save_int_values(String sSysvarParam, int iSysvalParam)
    Save integer values of various keys from the test results string.
    void
    save_long_values(String sSysvarParam, long lSysvalParam)
    Save long values of various keys from the test results string.
    void
    setC2sSFWTestResults(int iParamC2SRes)
    Set Client->Server fire-wall test results.
    void
    setS2cSFWTestResults(int iParamS2CRes)
    Set server->Client fire-wall test results.
    private void
    setsHostName(String sHostName)
    Sets the host name of the test server.
    void
    setUserAgent(String paramStrUserAgent)
    Set UserAgent String.
    void
    Display current status in Applet window.
    boolean
    test_c2s(Protocol paramProtoObj)
    Client to server throughput test.
    boolean
    test_meta(Protocol paramProtoObj, String application)
    The META test allows the Client to send an additional information to the Server that basically gets included along with the overall set of test results.
    boolean
    test_mid(Protocol paramProtoObj)
    Placeholder for the mid-link test; returns false without contacting the server.
    boolean
    test_s2c(Protocol paramProtoObj, Socket paramSocketObj)
    S2C throughput test to measure network bandwidth from server to client.
    boolean
    test_sfw(Protocol protocolObj)
    Placeholder for the SFW firewall test; returns false without contacting the server.
    void
    testResults(String sTestResParam)
    Method that interprets test results.

    Methods inherited from class JApplet

    getAppletContext, getCodeBase, start
    Modifier and Type
    Method
    Description
    Applet context.
    Code base.
    void
    Start the applet.

    Methods inherited from class JFrame

    destroy, dispose, getContentPane, toBack
    Modifier and Type
    Method
    Description
    void
    Destroy the frame (no-op).
    void
    Dispose the frame (no-op).
    Return the content pane.
    void
    Send frame to back (no-op).

    Methods inherited from class Component

    add, add, add, addMouseListener, addWindowListener, getToolkit, pack, repaint, setBorder, setCursor, setEditable, setEnabled, setForeground, setLayout, setLayout, setPreferredSize, setResizable, setSize, setTitle, setVisible
    Modifier and Type
    Method
    Description
    void
    add(int i, Component c)
    Stub, discards its arguments.
    void
    Stub, discards its arguments.
    void
    add(String str, Component c)
    Stub, discards its arguments.
    void
    Stub, discards its arguments.
    void
    Stub, discards its arguments.
    Creates a stub toolkit; this AWT emulation has no real one.
    void
    Stub, does nothing.
    void
    Stub, does nothing.
    void
    Stub, discards its arguments.
    void
    Stub, discards its arguments.
    void
    setEditable(boolean b)
    Stub, discards its arguments.
    void
    setEnabled(boolean b)
    Stub, discards its arguments.
    void
    Stub, discards its arguments.
    void
    Stub, discards its arguments.
    void
    Stub, discards its arguments.
    void
    Stub, discards its arguments.
    void
    setResizable(boolean b)
    Stub, discards its arguments.
    void
    setSize(int i, int j)
    Stub, discards its arguments.
    void
    Stub, discards its arguments.
    void
    setVisible(boolean b)
    Stub, discards its arguments.

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Compiler generated UID that does not follow naming convention, and is not related to functionality itself.
      See Also:
    • _txtDiagnosis

      JTextArea _txtDiagnosis
      Txt diagnosis.
    • _txtStatistics

      JTextArea _txtStatistics
      Txt diagnosis.
    • _resultsTxtPane

      ResultsTextPane _resultsTxtPane
      Results txt pane.
    • _sErrMsg

      String _sErrMsg
      Error message shown when a test fails.
    • _buttonStartTest

      JButton _buttonStartTest
      Button start test.
    • _buttonDetails

      JButton _buttonDetails
      Button details.
    • _buttonStatistics

      JButton _buttonStatistics
      Button statistics.
    • _chkboxDefaultTest

      JCheckBox _chkboxDefaultTest
      Chkbox default test.
    • _chkboxPreferIPv6

      JCheckBox _chkboxPreferIPv6
      Chkbox default test.
    • _spinnerTestCount

      JSpinner _spinnerTestCount
      Spinner test count.
    • _saDelays

      String[] _saDelays
      Sa delays.
    • _bFailed

      boolean _bFailed
      Set when the current test run failed.
    • _frameWeb100Vars

      NewFrame _frameWeb100Vars
      Frame web100 vars.
    • _frameDetailedStats

      NewFrame _frameDetailedStats
      Frame web100 vars.
    • _dTime

      double _dTime
      Elapsed test time in seconds.
    • _s2cspdUpdateTime

      int _s2cspdUpdateTime
      How often, in ms, the down and up speed displays are refreshed.
    • _c2sspdUpdateTime

      int _c2sspdUpdateTime
      How often, in ms, the down and up speed displays are refreshed.
    • _iECNEnabled

      int _iECNEnabled
      TCP feature flags: ECN, Nagle, and the MSS sent and received.
    • _iNagleEnabled

      int _iNagleEnabled
      TCP feature flags: ECN, Nagle, and the MSS sent and received.
    • MSSSent

      int MSSSent
      TCP feature flags: ECN, Nagle, and the MSS sent and received.
    • MSSRcvd

      int MSSRcvd
      TCP feature flags: ECN, Nagle, and the MSS sent and received.
    • _iSACKEnabled

      int _iSACKEnabled
      TCP feature flags: SACK, timestamps, and window scaling sent and received.
    • _iTimestampsEnabled

      int _iTimestampsEnabled
      TCP feature flags: SACK, timestamps, and window scaling sent and received.
    • _iWinScaleRcvd

      int _iWinScaleRcvd
      TCP feature flags: SACK, timestamps, and window scaling sent and received.
    • _iWinScaleSent

      int _iWinScaleSent
      TCP feature flags: SACK, timestamps, and window scaling sent and received.
    • _iFastRetran

      int _iFastRetran
      Congestion-control state: fast retransmits, ACKs out, smoothed RTT, and congestion window.
    • _iAckPktsOut

      int _iAckPktsOut
      Congestion-control state: fast retransmits, ACKs out, smoothed RTT, and congestion window.
    • _iSmoothedRTT

      int _iSmoothedRTT
      Congestion-control state: fast retransmits, ACKs out, smoothed RTT, and congestion window.
    • _iCurrentCwnd

      int _iCurrentCwnd
      Congestion-control state: fast retransmits, ACKs out, smoothed RTT, and congestion window.
    • _iMaxCwnd

      int _iMaxCwnd
      Congestion-control state: fast retransmits, ACKs out, smoothed RTT, and congestion window.
    • _iSndLimTimeRwin

      int _iSndLimTimeRwin
      Seconds spent send-limited by receive window, congestion window, and sender.
    • _iSndLimTimeCwnd

      int _iSndLimTimeCwnd
      Seconds spent send-limited by receive window, congestion window, and sender.
    • _iSndLimTimeSender

      int _iSndLimTimeSender
      Seconds spent send-limited by receive window, congestion window, and sender.
    • _iSndLimTransRwin

      int _iSndLimTransRwin
      Send-limited transfer counts for rwin, cwnd, and sender, plus max slow-start threshold.
    • _iSndLimTransCwnd

      int _iSndLimTransCwnd
      Send-limited transfer counts for rwin, cwnd, and sender, plus max slow-start threshold.
    • _iSndLimTransSender

      int _iSndLimTransSender
      Send-limited transfer counts for rwin, cwnd, and sender, plus max slow-start threshold.
    • _iMaxSsthresh

      int _iMaxSsthresh
      Send-limited transfer counts for rwin, cwnd, and sender, plus max slow-start threshold.
    • _iSumRTT

      int _iSumRTT
      RTT totals and counts, current MSS, timeouts, and retransmitted packets.
    • _iCountRTT

      int _iCountRTT
      RTT totals and counts, current MSS, timeouts, and retransmitted packets.
    • _iCurrentMSS

      int _iCurrentMSS
      RTT totals and counts, current MSS, timeouts, and retransmitted packets.
    • _iTimeouts

      int _iTimeouts
      RTT totals and counts, current MSS, timeouts, and retransmitted packets.
    • _iPktsRetrans

      int _iPktsRetrans
      RTT totals and counts, current MSS, timeouts, and retransmitted packets.
    • _iSACKsRcvd

      int _iSACKsRcvd
      SACKs received, duplicate ACKs in, and max receive window sent and received.
    • _iDupAcksIn

      int _iDupAcksIn
      SACKs received, duplicate ACKs in, and max receive window sent and received.
    • _iMaxRwinRcvd

      int _iMaxRwinRcvd
      SACKs received, duplicate ACKs in, and max receive window sent and received.
    • _iMaxRwinSent

      int _iMaxRwinSent
      SACKs received, duplicate ACKs in, and max receive window sent and received.
    • _iDataPktsOut

      int _iDataPktsOut
      Data packets out, socket buffer sizes, and ACKs in.
    • _iRcvbuf

      int _iRcvbuf
      Data packets out, socket buffer sizes, and ACKs in.
    • _iSndbuf

      int _iSndbuf
      Data packets out, socket buffer sizes, and ACKs in.
    • _iAckPktsIn

      int _iAckPktsIn
      Data packets out, socket buffer sizes, and ACKs in.
    • _iDataBytesOut

      long _iDataBytesOut
      Total data bytes sent to the client.
    • _iPktsOut

      int _iPktsOut
      Packets out, congestion signals, and receive-window scale.
    • _iCongestionSignals

      int _iCongestionSignals
      Packets out, congestion signals, and receive-window scale.
    • _iRcvWinScale

      int _iRcvWinScale
      Packets out, congestion signals, and receive-window scale.
    • _iPkts

      int _iPkts
      Packet count, buffer length, and current retransmission timeout.
    • _iLength

      int _iLength
      Packet count, buffer length, and current retransmission timeout.
    • _iCurrentRTO

      int _iCurrentRTO
      Packet count, buffer length, and current retransmission timeout.
    • _iC2sData

      int _iC2sData
      Message counts: client-to-server data and ACKs, server-to-client data and ACKs.
    • _iC2sAck

      int _iC2sAck
      Message counts: client-to-server data and ACKs, server-to-client data and ACKs.
    • _iS2cData

      int _iS2cData
      Message counts: client-to-server data and ACKs, server-to-client data and ACKs.
    • _iS2cAck

      int _iS2cAck
      Message counts: client-to-server data and ACKs, server-to-client data and ACKs.
    • _sServerType

      String _sServerType
      Server flavour, "web100" or "web10g", selects which messages the server understands.
    • _dS2cspd

      double _dS2cspd
      Measured speeds: server-to-client, client-to-server, and their slow-start phases.
    • _dC2sspd

      double _dC2sspd
      Measured speeds: server-to-client, client-to-server, and their slow-start phases.
    • _dSc2sspd

      double _dSc2sspd
      Measured speeds: server-to-client, client-to-server, and their slow-start phases.
    • _dSs2cspd

      double _dSs2cspd
      Measured speeds: server-to-client, client-to-server, and their slow-start phases.
    • _iSsndqueue

      int _iSsndqueue
      Server send-queue length.
    • _dSbytes

      double _dSbytes
      Total bytes sent by the server.
    • _yabuff2Write

      byte[] _yabuff2Write
      Scratch buffer for writing test data to the client.
    • _localeObj

      private Locale _localeObj
      Locale selected for the test display.
    • _resBundDisplayMsgs

      private ResourceBundle _resBundDisplayMsgs
      Bundle of translated test messages.
    • _sLang

      private String _sLang
      Language code for the display messages.
    • _sCountry

      private String _sCountry
      Country code for the display messages.
    • _sClient

      private String _sClient
      Client type reported to the test server.
    • half_duplex

      int half_duplex
      Half duplex.
    • congestion

      int congestion
      Half duplex.
    • bad_cable

      int bad_cable
      Half duplex.
    • mismatch

      int mismatch
      Half duplex.
    • loss

      double loss
      Packet loss rate.
    • estimate

      double estimate
      Packet loss rate.
    • avgrtt

      double avgrtt
      Packet loss rate.
    • spd

      double spd
      Packet loss rate.
    • waitsec

      double waitsec
      Packet loss rate.
    • timesec

      double timesec
      Packet loss rate.
    • rttsec

      double rttsec
      Packet loss rate.
    • order

      double order
      Packet ordering metric.
    • rwintime

      double rwintime
      Packet ordering metric.
    • sendtime

      double sendtime
      Packet ordering metric.
    • cwndtime

      double cwndtime
      Packet ordering metric.
    • rwin

      double rwin
      Packet ordering metric.
    • swin

      double swin
      Packet ordering metric.
    • cwin

      double cwin
      Packet ordering metric.
    • aspd

      double aspd
      Achievable speed.
    • _bIsApplication

      boolean _bIsApplication
      Set when the client is a native application rather than a browser.
    • _bTestInProgress

      private final AtomicBoolean _bTestInProgress
      True while a bandwidth test is running.
    • sHostName

      String sHostName
      Server host name used for the test.
    • hostAddress

      InetAddress hostAddress
      Host address.
    • _sTestResults

      String _sTestResults
      Accumulated human-readable test results and diagnostics.
    • _yTests

      byte _yTests
      Bit mask of the tests to run: C2S, S2C, status and meta.
    • _iC2sSFWResult

      int _iC2sSFWResult
      Middlebox (firewall) verdict for the client-to-server test.
    • _iS2cSFWResult

      int _iS2cSFWResult
      Middlebox (firewall) verdict for the server-to-client test.
    • pub_c2sspd

      private double pub_c2sspd
      Upload speed from client to server, in Kbps.
    • pub_s2cspd

      private double pub_s2cspd
      Download speed from server to client, in Kbps.
    • pub_CurRwinRcvd

      private int pub_CurRwinRcvd
      Current receive window advertised by the server.
    • pub_MaxRwinRcvd

      private int pub_MaxRwinRcvd
      Largest receive window advertised by the server.
    • pub_MinRTT

      private int pub_MinRTT
      Shortest round trip time during the test, in ms.
    • pub_MaxRTT

      private int pub_MaxRTT
      Longest round trip time during the test, in ms.
    • pub_loss

      private double pub_loss
      Packet loss during the test, as a fraction.
    • pub_avgrtt

      private double pub_avgrtt
      Average round trip time during the test, in ms.
    • pub_MinRTO

      private int pub_MinRTO
      Shortest retransmission timeout during the test.
    • pub_MaxRTO

      private int pub_MaxRTO
      Longest retransmission timeout during the test.
    • pub_CurRTO

      private int pub_CurRTO
      Current retransmission timeout during the test.
    • pub_SACKsRcvd

      private int pub_SACKsRcvd
      Selective acknowledgements received during the test.
    • pub_osVer

      private String pub_osVer
      Client OS version reported by the plugin.
    • pub_pluginVer

      private String pub_pluginVer
      Client plugin version reported to the server.
    • pub_host

      private String pub_host
      Client host name reported to the server.
    • pub_osName

      private String pub_osName
      Client OS name reported to the server.
    • pub_osArch

      private String pub_osArch
      Client OS architecture reported to the server.
    • pub_mismatch

      private int pub_mismatch
      Flag for a client-server version mismatch.
    • pub_Bad_cable

      private int pub_Bad_cable
      Flag for a bad cable modem condition.
    • pub_congestion

      private int pub_congestion
      Flag for network congestion during the test.
    • pub_cwndtime

      private double pub_cwndtime
      Share of the test spent in congestion window growth.
    • pub_pctRcvrLimited

      private double pub_pctRcvrLimited
      Share of the test limited by the receiver.
    • pub_AccessTech

      private String pub_AccessTech
      Client access technology, such as cable or DSL.
    • pub_natBox

      private String pub_natBox
      Client NAT box type reported by the plugin.
    • pub_DupAcksOut

      private int pub_DupAcksOut
      Duplicate acknowledgements sent during the test.
    • pub_DupAcksIn

      private int pub_DupAcksIn
      Duplicate acknowledgements received during the test.
    • pub_TimeStamp

      private Date pub_TimeStamp
      When the test finished.
    • pub_clientIP

      private String pub_clientIP
      Client IP address as seen by the server.
    • pub_Timeouts

      private int pub_Timeouts
      Retransmission timeouts during the test.
    • pub_errmsg

      private String pub_errmsg
      Error message from the test, if it failed.
    • pub_diagnosis

      private String pub_diagnosis
      Diagnosis of what limited the test result.
    • pub_statistics

      private String pub_statistics
      Test statistics formatted for display.
    • pub_status

      private String pub_status
      Status string shown to the test UI.
    • pub_time

      private double pub_time
      Elapsed time of the test, in seconds.
    • pub_bytes

      private long pub_bytes
      Bytes transferred during the test.
    • _sIsAutoRun

      private String _sIsAutoRun
      Parameter telling the applet to run automatically.
    • _sUserAgent

      private String _sUserAgent
      Browser user agent string, if supplied.
    • jsonSupport

      private boolean jsonSupport
      Whether the server supports JSON results.
    • retry

      private boolean retry
      Whether to retry a failed test.
    • _displayStatus

      private String _displayStatus
      Status text shown in the applet.
    • _context

      private final I2PAppContext _context
      The app context.
    • _log

      private final Log _log
      Logger for the test.
    • _useSSL

      private final boolean _useSSL
      Whether the test connects over SSL.
    • _sslFactory

      private final I2PSSLSocketFactory _sslFactory
      Factory for the SSL test sockets.
    • _sPanel

      private StatusPanel _sPanel
      Panel showing the test status.
    • _thread_group

      private ThreadGroup _thread_group
      Thread group holding the test threads.
  • Constructor Details

    • Tcpbw100

      public Tcpbw100(boolean useSSL)
      Tcpbw100.
      Parameters:
      useSSL - true to run the test over SSL, loading the certificates/ndt keystore
  • Method Details

    • main

      public static void main(String[] args)
      Public static void main for invoking as an Application.
      Parameters:
      args - String array of command line arguments
      Throws:
      IllegalArgumentException - on bad hostname
    • mainSupport

      public static Tcpbw100 mainSupport(String[] args)
      Builds and shows the applet in a 700x320 window from the command line.
      Parameters:
      args - -s to use SSL, then the hostname and an optional client id
      Returns:
      the started applet, already shown in its own window
      Throws:
      IllegalArgumentException - on bad hostname
    • get_c2sspd

      public String get_c2sspd()
      Measured upload (client-to-server) speed as a plain decimal string.
      Returns:
      the outbound throughput in MiB using base 10, 0 until a test runs
    • get_s2cspd

      public String get_s2cspd()
      Measured download (server-to-client) speed as a plain decimal string.
      Returns:
      the inbound throughput in MiB using base 10, 0 until a test runs
    • get_CurRwinRcvd

      public String get_CurRwinRcvd()
      Returns the current TCP receive window the server reported, in bytes.
      Returns:
      the current TCP receive window in bytes, 0 until the server reports it
    • get_MaxRwinRcvd

      public String get_MaxRwinRcvd()
      Returns the largest receive window the server reported, in bytes.
      Returns:
      the largest receive window seen in bytes, 0 until the server reports it
    • get_Ping

      public String get_Ping()
      Returns the minimum round trip time the server reported, in milliseconds.
      Returns:
      the minimum round trip time in milliseconds, 0 until the server reports it
    • get_MaxRTT

      public String get_MaxRTT()
      Returns the largest round trip time the server reported, in milliseconds.
      Returns:
      the maximum round trip time in milliseconds, 0 until the server reports it
    • get_loss

      public String get_loss()
      Returns the packet loss the server reported, as a fraction from 0 to 1.
      Returns:
      the packet loss as a fraction from 0 to 1, 0 until the server reports it
    • get_avgrtt

      public String get_avgrtt()
      Returns the average round trip time the server reported, in milliseconds.
      Returns:
      the average round trip time in milliseconds, 0 until the server reports it
    • get_CurRTO

      public String get_CurRTO()
      Returns the current retransmission timeout the server reported, in milliseconds.
      Returns:
      the current retransmission timeout in milliseconds, 0 until reported
    • get_SACKsRcvd

      public String get_SACKsRcvd()
      Returns the count of selective acknowledgement packets the client received.
      Returns:
      the number of selective acknowledgement packets received
    • get_osVer

      public String get_osVer()
      Returns the operating system version the client reported.
      Returns:
      the client OS version, "unknown" until the client reports it
    • get_pluginVer

      public String get_pluginVer()
      Returns the plugin version the client reported.
      Returns:
      the client plugin version, "unknown" until the client reports it
    • get_host

      public String get_host()
      Returns the host name this applet is pointed at.
      Returns:
      the host the test ran against, "unknown" until set
    • get_osName

      public String get_osName()
      Returns the operating system name the client reported.
      Returns:
      the client OS name, "unknown" until the client reports it
    • get_osArch

      public String get_osArch()
      Returns the operating system architecture the client reported.
      Returns:
      the client OS architecture, "unknown" until the client reports it
    • get_mismatch

      public String get_mismatch()
      Reports whether the server saw a speed mismatch between the two directions.
      Returns:
      "yes" if the server reported a speed mismatch, otherwise "no"
    • get_Bad_cable

      public String get_Bad_cable()
      Reports whether the server flagged the link as a bad cable.
      Returns:
      "yes" if the server flagged a bad cable, otherwise "no"
    • get_congestion

      public String get_congestion()
      Reports whether the server flagged congestion on the link.
      Returns:
      "yes" if the server flagged congestion, otherwise "no"
    • get_cwndtime

      public String get_cwndtime()
      Returns the fraction of the run limited by the congestion window.
      Returns:
      the fraction of the run spent limited by the congestion window
    • get_AccessTech

      public String get_AccessTech()
      Returns the access technology the server detected for the link.
      Returns:
      the access technology the server detected, "unknown" until reported
    • get_rcvrLimiting

      public String get_rcvrLimiting()
      Returns the percentage of the run the receive buffer was too small.
      Returns:
      the percentage of the run the receive buffer was too small
    • get_optimalRcvrBuffer

      public String get_optimalRcvrBuffer()
      Suggests a receive buffer size in KiB, derived from the largest window seen.
      Returns:
      the largest receive window scaled by 1024, the suggested buffer size in KiB
    • get_clientIP

      public String get_clientIP()
      Returns the client address the server saw, as text.
      Returns:
      the client IP as the server saw it, "unknown" until reported
    • get_natStatus

      public String get_natStatus()
      Returns the NAT type the server detected for this client.
      Returns:
      the NAT type the server detected, "unknown" until reported
    • get_DupAcksOut

      public String get_DupAcksOut()
      Returns the count of duplicate acknowledgements the client sent.
      Returns:
      the number of duplicate acknowledgements sent
    • get_DupAcksIn

      public String get_DupAcksIn()
      Returns the count of duplicate acknowledgements the client received.
      Returns:
      the number of duplicate acknowledgements received
    • get_TimeStamp

      public String get_TimeStamp()
      Returns the clock stamp the server sent, or the word unknown when absent.
      Returns:
      the server timestamp, or "unknown" if it sent none
    • get_PcBuffSpdLimit

      public String get_PcBuffSpdLimit()
      Returns the throughput ceiling the receive window over round trip time sets.
      Returns:
      the throughput ceiling the local receive buffer imposes, in bytes per second
    • get_jitter

      public String get_jitter()
      Returns the spread between the largest and smallest round trip times, in milliseconds.
      Returns:
      the spread between the maximum and minimum round trip times, in milliseconds
    • get_WaitSec

      public String get_WaitSec()
      Estimates the stall time in seconds from the current timeout and its count.
      Returns:
      the estimated stall time in seconds, the current RTO times the timeout count
    • get_errmsg

      public String get_errmsg()
      Returns the error text left behind by the most recent run.
      Returns:
      the error from the last run, "Test not run." if there was none
    • get_diagnosis

      public String get_diagnosis()
      Returns the diagnosis text left behind by the most recent run.
      Returns:
      the diagnosis from the last run, "Test not run." if there was none
    • get_statistics

      public String get_statistics()
      Returns the statistics summary left behind by the most recent run.
      Returns:
      the statistics from the last run, "Test not run." if there was none
    • get_status

      public String get_status()
      Returns the current run state, notStarted until a test begins.
      Returns:
      the test status, "notStarted" until the run begins
    • get_instSpeed

      public String get_instSpeed()
      Returns the speed measured since the last sample, in bits per millisecond.
      Returns:
      the speed since the last sample, in bits per millisecond
    • getUserAgent

      public String getUserAgent()
      Set UserAgent String containing browser details.
      Returns:
      String UserAgent details set locally
      See Also:
    • setUserAgent

      public void setUserAgent(String paramStrUserAgent)
      Set UserAgent String.
      Parameters:
      paramStrUserAgent - UserAgent String to be set locally
      See Also:
    • getC2sSFWTestResults

      public int getC2sSFWTestResults()
      Get Client->Server fire-wall test results.
      Returns:
      integer indicating C->S test results
    • setC2sSFWTestResults

      public void setC2sSFWTestResults(int iParamC2SRes)
      Set Client->Server fire-wall test results.
      Parameters:
      iParamC2SRes - integer indicating C->S test results
    • getS2cSFWTestResults

      public int getS2cSFWTestResults()
      Get Server->Client fire-wall test results.
      Returns:
      integer indicating C->S test results
    • setS2cSFWTestResults

      public void setS2cSFWTestResults(int iParamS2CRes)
      Set server->Client fire-wall test results.
      Parameters:
      iParamS2CRes - integer indicating C->S test results
    • isTestInProgress

      public boolean isTestInProgress()
      Reports whether a test run is currently in progress.
      Returns:
      whether a test run is in progress right now
    • run_test

      public void run_test()
      "Remote Control" function - invoke NDT' runtest() method from the API.
    • init

      public void init()
      Initialize the base NDT window Applet init() method.
    • createMainWindow

      private void createMainWindow()
      Initialize the "main" window. The main window is composed of 1. The results pane, which describes the process and displays their results 2. The buttons pane, which houses all the buttons for various options.
    • createDiagnoseWindow

      public void createDiagnoseWindow()
      Create the "More details" window.
    • createStatsWindow

      public void createStatsWindow()
      Create the "Statistics" window.
    • runtest

      public void runtest()
      Run the Thread that calls the "dottcp" method to run tests. This method is called by the Applet's init method if user selected an "autorun" option, is run individually if user presses the "start button", or, is internally invoked by the API call.
    • actionPerformed

      public void actionPerformed(ActionEvent paramEventObj)
      Action handler method called when an associated action is performed.
      Parameters:
      paramEventObj - Event object that prompted the call
    • showStatus

      public void showStatus(String msg)
      Display current status in Applet window.
      Overrides:
      showStatus in class JApplet
      Parameters:
      msg - String value of status
    • getStatus

      public String getStatus()
      I2P Translated status, not HTML escaped.
      Returns:
      the current status line, localized and not HTML escaped
    • test_mid

      public boolean test_mid(Protocol paramProtoObj) throws IOException
      Placeholder for the mid-link test; returns false without contacting the server.
      Parameters:
      paramProtoObj - Protocol Object used to exchange messages
      Returns:
      boolean, true if test was not completed, false if test was completed.
      Throws:
      IOException - when sending/receiving messages from server fails
    • test_sfw

      public boolean test_sfw(Protocol protocolObj) throws IOException
      Placeholder for the SFW firewall test; returns false without contacting the server.
      Parameters:
      protocolObj - Protocol Object used to exchange messages
      Returns:
      boolean, true if test was not completed, false if test was completed.
      Throws:
      IOException - when sending/receiving messages from server fails
    • test_c2s

      public boolean test_c2s(Protocol paramProtoObj) throws IOException
      Client to server throughput test. This test performs 10 seconds memory-to-memory data transfer to test achievable network bandwidth.
      Parameters:
      paramProtoObj - Protocol Object used to exchange messages
      Returns:
      boolean, true if test was not completed, false if test was completed.
      Throws:
      IOException - when sending/receiving messages from server fails
      See Also:
    • test_s2c

      public boolean test_s2c(Protocol paramProtoObj, Socket paramSocketObj) throws IOException
      S2C throughput test to measure network bandwidth from server to client.
      Parameters:
      paramProtoObj - Protocol Object used to exchange messages
      paramSocketObj - Socket Object to write/read NDTProtocol control messages
      Returns:
      boolean, true if test was not completed, false if test was completed.
      Throws:
      IOException - When sending/receiving messages from server fails
      See Also:
    • test_meta

      public boolean test_meta(Protocol paramProtoObj, String application) throws IOException
      The META test allows the Client to send an additional information to the Server that basically gets included along with the overall set of test results.
      Parameters:
      paramProtoObj - Protocol Object used to exchange protocol messages
      application - the META information to send alongside the test results
      Returns:
      boolean, true if test was completed, false if test is incomplete.
      Throws:
      IOException - When sending/receiving messages from server fails
      See Also:
    • dottcp

      public void dottcp(StatusPanel sPanel) throws IOException
      Method to run tests and interpret the results sent by the server.
      Parameters:
      sPanel - StatusPanel object to describe status of tests
      Throws:
      IOException - When sending/receiving messages from server fails
      See Also:
    • newSocket

      private Socket newSocket(InetAddress hostAddress, int ctlPort) throws IOException
      Return a SSL or standard socket depending on config.
      Parameters:
      hostAddress - the host to connect to
      ctlPort - the control port to connect to
      Returns:
      a connected socket, SSL or plain per _useSSL
      Throws:
      IOException - if the connection fails
    • testResults

      public void testResults(String sTestResParam)
      Method that interprets test results. This routine extracts the key-value pairs of results of various categories and assigns these to the correct variables. These values are then interpreted to make decisions about various measurement items and written to the main results, statistics or web100 panels.
      Parameters:
      sTestResParam - String containing all results
    • save_dbl_values

      public void save_dbl_values(String sSysvarParam, double dSysvalParam)
      Save double values of various keys from the test results string.
      Parameters:
      sSysvarParam - key name (e.g. "bw:", "loss:")
      dSysvalParam - parsed double value
    • save_long_values

      public void save_long_values(String sSysvarParam, long lSysvalParam)
      Save long values of various keys from the test results string.
      Parameters:
      sSysvarParam - key name (e.g. "DataBytesOut:")
      lSysvalParam - parsed long value
    • save_int_values

      public void save_int_values(String sSysvarParam, int iSysvalParam)
      Save integer values of various keys from the test results string.
      Parameters:
      sSysvarParam - key name (e.g. "MSSSent:", "Timeouts:")
      iSysvalParam - parsed integer value
    • isValueSave

      private boolean isValueSave(String sSysvarParam)
      Check if the given key is one whose value is saved by save_int_values(String, int), save_dbl_values(), or save_long_values().
      Parameters:
      sSysvarParam - key name string from test results
      Returns:
      true if the key is recognized and saved
    • getParameter

      public String getParameter(String paramStrName)
      Utility method to get parameter value.
      Overrides:
      getParameter in class JApplet
      Parameters:
      paramStrName - Key String whose value has to be found
      Returns:
      String Value of key requested for
    • setsHostName

      private void setsHostName(String sHostName)
      Sets the host name of the test server.
      Parameters:
      sHostName - the server host name
    • getNDTvar

      public String getNDTvar(String varName)
      Function that returns a variable corresponding to the parameter passed to it as a request.
      Parameters:
      varName - {String} The parameter which the caller is seeking.
      Returns:
      {String} The value of the desired parameter.
    • parseMsgBodyToInt

      private int parseMsgBodyToInt(String msg)
      Parse a message body string to an integer using base 10.
      Parameters:
      msg - string to parse
      Returns:
      parsed value, or 0 on failure
    • parseMsgBodyToInt

      private int parseMsgBodyToInt(String msg, int radix)
      Parse a message body string to an integer using the given radix.
      Parameters:
      msg - string to parse
      radix - numeric base (e.g. 10 or 16)
      Returns:
      parsed value, or 0 on failure
    • killIt

      public void killIt()
      Stop the test and kill its thread group. Only valid after the test was started via main(String[]) or runIt().
    • runIt

      public void runIt()
      Runs the configured tests on a daemon thread in a private daemon thread group, so an uncaught error is logged rather than reaching the default handler.