示例#1
0
 void init() throws NetworkException {
   synchronized (_lock) {
     _collector = Collector.Factory.create();
     _transport = Transport.Factory.create();
     _connection = Connection.Factory.create();
     String id = _settings.getId();
     _connection.collect(_collector);
     _connection.setContainer(
         id == null || id.trim().equals("") ? UUID.randomUUID().toString() : id);
     _connection.setHostname(_settings.getHost());
     _transport.bind(_connection);
     Sasl sasl = _transport.sasl();
     sasl.client();
     sasl.setMechanisms(new String[] {"ANONYMOUS"});
     _connection.open();
     _connected.set(true);
     write();
   }
 }
示例#2
0
 @Override
 public String getLocalID() {
   return _settings != null ? _settings.getId() : null;
 }