Adding command-line options for test mode and interface.

Test mode puts the output into unbuffered mode and allows the user to attempt to connect a station to itself.
More fixes for the is_valid checking for connect/disconnect.