public static EndpointDescription selectEndpoint(EndpointDescription[] endpoints){
  if (endpoints == null)   throw new IllegalArgumentException("null arg");
  endpoints=EndpointUtil.selectByProtocol(endpoints,"opc.tcp");
  endpoints=EndpointUtil.selectByMessageSecurityMode(endpoints,MessageSecurityMode.SignAndEncrypt);
  if (endpoints.length == 0)   return null;
  endpoints=EndpointUtil.sortBySecurityLevel(endpoints);
  EndpointUtil.reverse(endpoints);
  return endpoints[0];
}

public static EndpointDescription selectEndpoint ( EndpointDescription [ ] endpoints ) { if ( endpoints == null ) throw new IllegalArgumentException ( "null arg" ) ; endpoints = EndpointUtil . selectByProtocol ( endpoints , "opc.tcp" ) ; endpoints = EndpointUtil . selectByMessageSecurityMode ( endpoints , MessageSecurityMode . SignAndEncrypt ) ; if ( endpoints . length == 0 ) return null ; endpoints = EndpointUtil . sortBySecurityLevel ( endpoints ) ; EndpointUtil . reverse ( endpoints ) ; return endpoints [ 0 ] ; }
select the most suitable endpoint . < p > selection uses the following precedence : 1 ) protocol must be opc . tcp ( as http is not implemented ) 2 ) security uses sign & encrypt 3 ) select highest security level ( determined by the server ) 4 ) prefer hostname over localhost
