public ViaHeader createViaHeader(String host,int port,String transport,String branch) throws ParseException, InvalidArgumentException {
  if (host == null || transport == null)   throw new NullPointerException("null arg");
  Via via=new Via();
  if (branch != null)   via.setBranch(branch);
  if (host.indexOf(':') >= 0 && host.indexOf('[') < 0) {
    if (stripAddressScopeZones) {
      int zoneStart=host.indexOf('%');
      if (zoneStart != -1)       host=host.substring(0,zoneStart);
    }
    host='[' + host + ']';
  }
  via.setHost(host);
  via.setPort(port);
  via.setTransport(transport);
  return via;
}

public ViaHeader createViaHeader ( String host , int port , String transport , String branch ) throws ParseException , InvalidArgumentException { if ( host == null || transport == null ) throw new NullPointerException ( "null arg" ) ; Via via = new Via ( ) ; if ( branch != null ) via . setBranch ( branch ) ; if ( host . indexOf ( ':' ) >= 0 && host . indexOf ( '[' ) < 0 ) { if ( stripAddressScopeZones ) { int zoneStart = host . indexOf ( '%' ) ; if ( zoneStart != - 1 ) host = host . substring ( 0 , zoneStart ) ; } host = '[' + host + ']' ; } via . setHost ( host ) ; via . setPort ( port ) ; via . setTransport ( transport ) ; return via ; }
creates a new viaheader based on the newly supplied uri and branch values .
