@Override
  public void onConnectionBound(Event event) {
    Transport transport = event.getTransport();
    SslDomain domain = Proton.sslDomain();
    domain.init(Mode.SERVER);

    domain.setPeerAuthentication(SslDomain.VerifyMode.ANONYMOUS_PEER);
    transport.ssl(domain);

    Sasl sasl = transport.sasl();
    sasl.allowSkip(true);
    sasl.setMechanisms("PLAIN");
    // sasl.done(SaslOutcome.PN_SASL_OK);*/
  }
Exemple #2
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();
   }
 }
Exemple #3
0
 private void pumpToProtonTransport() {
   try {
     boolean done = false;
     while (!done) {
       ByteBuffer toWrite = protonTransport.getOutputBuffer();
       if (toWrite != null && toWrite.hasRemaining()) {
         // TODO - Get Bytes in a readable form
         if (isTraceBytes()) {
           TRACE_BYTES.info("Sending: {}", toWrite.toString());
         }
         transport.send(toWrite);
         protonTransport.outputConsumed();
       } else {
         done = true;
       }
     }
   } catch (IOException e) {
     fireProviderException(e);
   }
 }