Ported tls_handshake.py to be a nettest, rather than an external script.
Fix #8329, txscapy.PcapDummyWriter.write() has wrong signature method.
Add Exception classes for conditions when the network is not reachable and
when a TLS/SSL context was not chosen from the test commandline options.
Fix an error in the commandline options parsing which allowed commandline host
IP:port inputs in addition to a file of inputs, which would throw off the
input_id counter and mess up reporting.
Add notes explaining defaults chosen if no commandline options are chosen, and
a note-to-self to explain to users that currently only one TLS/SSL context
method can be chosen at a time.

 * TODO add support for looping through multiple TLS/SSL contexts.
Switch to setting the TLS/SSL methods in setUp(), rather than in getContext().
Fix the logic on detecting if we have a config setting.

 * We can't use hasattr(config.basic, 'foo') because this gives None if not
   set, which means the default in the test doesn't get set. Instead, we want
   to use:
       if getattr(config.basic, 'foo', None) is not None:
Set the default socket timeout to 30 seconds.
Change getContext() to only set the ciphersuite list, and add method
getPeerCert() for dumping the server x509 certificate.
Add support for parsing the server certificate chain into a list of x509 certs
in method getPeerCert().
Change method makeConnection to use self.input as-is, and add docstring.
In connectionFailed, handle an error from makeConnection() where on some
systems, /dev/random is apparently set to 0600 root:root, and also add
handling for propagating errors due to the network/server being unreachable.
Add connectionRenegotiate() method for calling methods to either handle
SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE, as may be the case.
Add method handleWantRead() for handling SSL_ERROR_WANT_READ until OpenSSL's
memory BIO state machine reports that it has been handled, and also jump to
the SSL_ERROR_WANT_WRITE handler when/if that error occurs.
Add method connectionShutdown() for calling shutdown on the TLS/SSL handshake,
and the socket, and for handling instances where the connection has been
halfway closed.
Add method handleWantWrite() for resending already sent data over the
connection, if OpenSSL's memory BIO state machine reports this error, and also
jump to the SSL_ERROR_WANT_READ handler if at any point that error is raised.
Add check for handshake timeout by sending 3 bytes along the connection.

  * Currently we send 'o\r\n'. TODO: we should look up a more common string
    that is sent, perhaps one for each of the major browsers, to emulate a
    more normal connection, and decrease fingerprintability.
  * Add calls to the SSL_ERROR_WANT_READ and SSL_ERROR_WANT_WRITE handlers,
    handleWantRead() and handleWantWrite(), to method doHandshake().
  * Add timeout notice if repetitive want_writes occur in doHandshake().
  * Add call to connectionRenegotiate() if multiple want_reads occur in method
    doHandshake().
Add logging of undetermined states reported by OpenSSL's state machine to
doHandshake(). This should not ever occur, but just in case it does, we'll
want to log it rather than throwing the Exception out.
Add reporting mechanisms to handshakeSucceeded() for storing the x509
certificate and chain in a way that YAML won't complain about.

  * TODO: we may want to look into a better method for serialising
    certificates that is compatible with YAML, rather than just storing them
    as PEM encoded certs in a string.
  * Also, pyOpenSSL will segfault if you try to check the cert. Added a
    warning in the docstring of method handshakeSucceeded() about that.
Add reporting of statistics for when the handshake fails.