code: private void chooseCipherSuite(ClientHello mesg) throws IOException {
          for (CipherSuite suite : mesg.getCipherSuites().collection()) {
              if (isNegotiable(suite) == false) {
                  continue;
              }
  
              if (doClientAuth == SSLEngineImpl.clauth_required) {
                  if ((suite.keyExchange == K_DH_ANON) ||
                      (suite.keyExchange == K_ECDH_ANON)) {
                      continue;
                  }
              }
              if (trySetCipherSuite(suite) == false) {
                  continue;
              }
              return;
          }
          fatalSE(Alerts.alert_handshake_failure,
                      "no cipher suites in common");
      }
docs: /*
  Choose cipher suite from among those supported by client. Sets
  the cipherSuite and keyExchange variables.