public boolean isValid(){
  return valid && !s.isClosed() && !s.isInputShutdown()&& !s.isOutputShutdown();
}

public boolean isValid ( ) { return valid && ! s . isClosed ( ) && ! s . isInputShutdown ( ) && ! s . isOutputShutdown ( ) ; }
method to see if the connection is usable
