docs: public synchronized boolean disconnect ( boolean hard, boolean inUse ) throws IOException {
          IOException ioe = null;
  
          switch ( this.state ) {
          case 0: /* not connected - just return */
          case 5:
          case 6:
              return false;
          case 2:
              hard = true;
          case 3: /* connected - go ahead and disconnect */
              if ( this.response_map.size() != 0 && !hard && inUse ) {
                  break; /* outstanding requests */
              }
              try {
                  this.state = 5;
                  boolean wasInUse = doDisconnect(hard, inUse);
                  this.state = 6;
                  return wasInUse;
              }
              catch ( IOException ioe0 ) {
                  this.state = 6;
                  ioe = ioe0;
              }
          case 4: /* failed to connect - reset the transport */
              // thread is cleaned up by connect routine, joining it here causes a deadlock
              this.thread = null;
              this.state = 6;
              break;
          default:
              log.error("Invalid state: " + this.state);
              this.thread = null;
              this.state = 6;
              break;
          }
  
          if ( ioe != null )
              throw ioe;
  
          return false;
      }