private void assertViaHeaders(final String... vias) throws Exception {
    final String[] formatedViaValues = new String[vias.length];
    for (int i = 0; i < vias.length; ++i) {
      formatedViaValues[i] = String.format(vias[i], i);
      if (formatedViaValues[i].startsWith("Via: ")) {
        formatedViaValues[i] = formatedViaValues[i].substring("Via: ".length());
      }
    }

    SipResponse response = createResponseWithViaHeaders(vias);

    // this should always return the top-most via header which will
    // always have the branchBase-0 as its branch since that is how we generate
    // the branches...
    final ViaHeader via = response.getViaHeader();
    assertThat(via.getBranch().toString(), is(this.branchBase + 0));
    assertThat(via.getValue().toString(), is(formatedViaValues[0]));

    // make sure that the other Via-header is still in the msg
    assertViasInMessageDump(response, formatedViaValues);

    // do it again but ask for all the Via headers up front since
    // the parsing may be slightly different (which it is)
    response = createResponseWithViaHeaders(vias);
    final List<ViaHeader> viaHeaders = response.getViaHeaders();
    assertThat(viaHeaders.size(), is(vias.length));
    for (int i = 0; i < viaHeaders.size(); ++i) {
      assertThat(viaHeaders.get(i).getBranch().toString().contains(this.branchBase + i), is(true));
    }
  }