Search in sources :

Example 1 with ProtonSaslAuthenticatorFactory

use of io.vertx.proton.sasl.ProtonSaslAuthenticatorFactory in project vertx-proton by vert-x3.

the class ProtonServerImplTest method testCustomAuthenticatorHasInitCalled.

@Test(timeout = 20000)
public void testCustomAuthenticatorHasInitCalled(TestContext context) {
    Async initCalledAsync = context.async();
    ProtonServer.create(vertx).saslAuthenticatorFactory(new ProtonSaslAuthenticatorFactory() {

        @Override
        public ProtonSaslAuthenticator create() {
            return new ProtonSaslAuthenticator() {

                @Override
                public void init(NetSocket socket, ProtonConnection protonConnection, Transport transport) {
                    initCalledAsync.complete();
                }

                @Override
                public void process(Handler<Boolean> completionHandler) {
                    completionHandler.handle(false);
                }

                @Override
                public boolean succeeded() {
                    return false;
                }
            };
        }
    }).connectHandler(protonConnection -> {
    }).listen(server -> ProtonClient.create(vertx).connect("localhost", server.result().actualPort(), protonConnectionAsyncResult -> {
    }));
}
Also used : NetSocket(io.vertx.core.net.NetSocket) TestContext(io.vertx.ext.unit.TestContext) ProtonConnection(io.vertx.proton.ProtonConnection) Async(io.vertx.ext.unit.Async) ProtonSaslAuthenticator(io.vertx.proton.sasl.ProtonSaslAuthenticator) Vertx(io.vertx.core.Vertx) RunWith(org.junit.runner.RunWith) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) ProtonClient(io.vertx.proton.ProtonClient) Test(org.junit.Test) VertxUnitRunner(io.vertx.ext.unit.junit.VertxUnitRunner) Sasl(org.apache.qpid.proton.engine.Sasl) SaslOutcome(org.apache.qpid.proton.engine.Sasl.SaslOutcome) Context(io.vertx.core.Context) ProtonServer(io.vertx.proton.ProtonServer) StandardCharsets(java.nio.charset.StandardCharsets) Transport(org.apache.qpid.proton.engine.Transport) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) After(org.junit.After) Handler(io.vertx.core.Handler) ProtonSaslAuthenticatorFactory(io.vertx.proton.sasl.ProtonSaslAuthenticatorFactory) NetSocket(io.vertx.core.net.NetSocket) Before(org.junit.Before) ProtonSaslAuthenticatorFactory(io.vertx.proton.sasl.ProtonSaslAuthenticatorFactory) ProtonConnection(io.vertx.proton.ProtonConnection) Async(io.vertx.ext.unit.Async) Transport(org.apache.qpid.proton.engine.Transport) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) ProtonSaslAuthenticator(io.vertx.proton.sasl.ProtonSaslAuthenticator) Test(org.junit.Test)

Aggregations

Context (io.vertx.core.Context)1 Handler (io.vertx.core.Handler)1 Vertx (io.vertx.core.Vertx)1 NetSocket (io.vertx.core.net.NetSocket)1 Async (io.vertx.ext.unit.Async)1 TestContext (io.vertx.ext.unit.TestContext)1 VertxUnitRunner (io.vertx.ext.unit.junit.VertxUnitRunner)1 ProtonClient (io.vertx.proton.ProtonClient)1 ProtonConnection (io.vertx.proton.ProtonConnection)1 ProtonServer (io.vertx.proton.ProtonServer)1 ProtonSaslAuthenticator (io.vertx.proton.sasl.ProtonSaslAuthenticator)1 ProtonSaslAuthenticatorFactory (io.vertx.proton.sasl.ProtonSaslAuthenticatorFactory)1 StandardCharsets (java.nio.charset.StandardCharsets)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Sasl (org.apache.qpid.proton.engine.Sasl)1 SaslOutcome (org.apache.qpid.proton.engine.Sasl.SaslOutcome)1 Transport (org.apache.qpid.proton.engine.Transport)1 After (org.junit.After)1 Before (org.junit.Before)1