@Test public void testProtocolTracingLogsToSystem() { TransportImpl transport = new TransportImpl(); transport.trace(2); TransportImpl spy = spy(transport); final String testMechName = "TESTMECH"; SaslMechanisms mechs = new SaslMechanisms(); mechs.setSaslServerMechanisms(Symbol.valueOf(testMechName)); SaslImpl sasl = new SaslImpl(spy, 512); sasl.handle(mechs, null); ArgumentCaptor<SaslMechanisms> frameBodyCatcher = ArgumentCaptor.forClass(SaslMechanisms.class); verify(spy).log(eq(TransportImpl.INCOMING), frameBodyCatcher.capture()); Symbol[] expectedMechs = new Symbol[] { Symbol.valueOf(testMechName)}; assertArrayEquals(expectedMechs, frameBodyCatcher.getValue().getSaslServerMechanisms()); }
@Override public void handle(SaslFrameBody frameBody, Binary payload) { _transport.log(TransportImpl.INCOMING, frameBody); ProtocolTracer tracer = _transport.getProtocolTracer(); if( tracer != null ) { tracer.receivedSaslBody(frameBody); } frameBody.invoke(this, payload, null); }
SaslImpl implements Sasl, SaslFrameBody.SaslFrameBodyHandler<Void>, SaslFrameHandler, TransportLayer { @Override public void handle(SaslFrameBody frameBody, Binary payload) { _transport.log(TransportImpl.INCOMING, frameBody); ProtocolTracer tracer = _transport.getProtocolTracer(); if( tracer != null ) { tracer.receivedSaslBody(frameBody); } frameBody.invoke(this, payload, null); } }
SaslImpl implements Sasl, SaslFrameBody.SaslFrameBodyHandler<Void>, SaslFrameHandler, TransportLayer { @Override public void handle(SaslFrameBody frameBody, Binary payload) { _transport.log(TransportImpl.INCOMING, frameBody); ProtocolTracer tracer = _transport.getProtocolTracer(); if( tracer != null ) { tracer.receivedSaslBody(frameBody); } frameBody.invoke(this, payload, null); } SaslImpl(TransportImpl transport, int maxFrameSize); }
SaslImpl implements Sasl, SaslFrameBody.SaslFrameBodyHandler<Void>, SaslFrameHandler, TransportLayer { @Override public void handle(SaslFrameBody frameBody, Binary payload) { _transport.log(TransportImpl.INCOMING, frameBody); ProtocolTracer tracer = _transport.getProtocolTracer(); if( tracer != null ) { tracer.receivedSaslBody(frameBody); } frameBody.invoke(this, payload, null); } SaslImpl(TransportImpl transport, int maxFrameSize); @Override boolean isDone(); @Override final int recv(byte[] bytes, int offset, int size); @Override final int send(byte[] bytes, int offset, int size); @Override int pending(); @Override SaslState getState(); @Override void setMechanisms(String... mechanisms); @Override String[] getRemoteMechanisms(); void setMechanism(Symbol mechanism); Symbol getChosenMechanism(); void setResponse(Binary initialResponse); @Override void handle(SaslFrameBody frameBody, Binary payload); @Override void handleInit(SaslInit saslInit, Binary payload, Void context); @Override void handleResponse(SaslResponse saslResponse, Binary payload, Void context); @Override void done(SaslOutcome outcome); @Override void handleMechanisms(SaslMechanisms saslMechanisms, Binary payload, Void context); @Override void handleChallenge(SaslChallenge saslChallenge, Binary payload, Void context); @Override void handleOutcome(org.apache.qpid.proton.amqp.security.SaslOutcome saslOutcome,
                              Binary payload,
                              Void context); @Override void plain(String username, String password); @Override SaslOutcome getOutcome(); @Override void client(); @Override void server(); @Override void allowSkip(boolean allowSkip); @Override TransportWrapper wrap(final TransportInput input, final TransportOutput output); @Override String toString(); @Override String getHostname(); @Override void setRemoteHostname(String hostname); @Override void setListener(SaslListener saslListener); }
SaslImpl implements Sasl, SaslFrameBody.SaslFrameBodyHandler<Void>, SaslFrameHandler, TransportLayer { @Override public void handle(SaslFrameBody frameBody, Binary payload) { _transport.log(TransportImpl.INCOMING, frameBody); ProtocolTracer tracer = _transport.getProtocolTracer(); if( tracer != null ) { tracer.receivedSaslBody(frameBody); } frameBody.invoke(this, payload, null); } SaslImpl(TransportImpl transport, int maxFrameSize); @Override boolean isDone(); @Override final int recv(byte[] bytes, int offset, int size); @Override final int send(byte[] bytes, int offset, int size); @Override int pending(); @Override SaslState getState(); @Override void setMechanisms(String... mechanisms); @Override String[] getRemoteMechanisms(); void setMechanism(Symbol mechanism); Symbol getChosenMechanism(); void setResponse(Binary initialResponse); @Override void handle(SaslFrameBody frameBody, Binary payload); @Override void handleInit(SaslInit saslInit, Binary payload, Void context); @Override void handleResponse(SaslResponse saslResponse, Binary payload, Void context); @Override void done(SaslOutcome outcome); @Override void handleMechanisms(SaslMechanisms saslMechanisms, Binary payload, Void context); @Override void handleChallenge(SaslChallenge saslChallenge, Binary payload, Void context); @Override void handleOutcome(org.apache.qpid.proton.amqp.security.SaslOutcome saslOutcome,
                              Binary payload,
                              Void context); @Override void plain(String username, String password); @Override SaslOutcome getOutcome(); @Override void client(); @Override void server(); @Override void allowSkip(boolean allowSkip); @Override TransportWrapper wrap(final TransportInput input, final TransportOutput output); @Override String toString(); @Override String getHostname(); @Override void setRemoteHostname(String hostname); @Override void setListener(SaslListener saslListener); static final byte SASL_FRAME_TYPE; }