Search in sources :

Example 1 with StubTransportListener

use of org.apache.activemq.transport.StubTransportListener in project activemq-artemis by apache.

the class SslTransportTest method createTransportAndConsume.

private void createTransportAndConsume(boolean wantAuth, boolean needAuth) throws IOException {
    JMXPrincipal principal = new JMXPrincipal(certDistinguishedName);
    X509Certificate cert = new StubX509Certificate(principal);
    StubSSLSession sslSession = new StubSSLSession(cert);
    sslSocket = new StubSSLSocket(sslSession);
    sslSocket.setWantClientAuth(wantAuth);
    sslSocket.setNeedClientAuth(needAuth);
    SslTransport transport = new SslTransport(new ObjectStreamWireFormat(), sslSocket);
    stubListener = new StubTransportListener();
    transport.setTransportListener(stubListener);
    ConnectionInfo sentInfo = new ConnectionInfo();
    sentInfo.setUserName(username);
    sentInfo.setPassword(password);
    transport.doConsume(sentInfo);
}
Also used : JMXPrincipal(javax.management.remote.JMXPrincipal) ConnectionInfo(org.apache.activemq.command.ConnectionInfo) X509Certificate(java.security.cert.X509Certificate) StubTransportListener(org.apache.activemq.transport.StubTransportListener) ObjectStreamWireFormat(org.apache.activemq.wireformat.ObjectStreamWireFormat)

Aggregations

X509Certificate (java.security.cert.X509Certificate)1 JMXPrincipal (javax.management.remote.JMXPrincipal)1 ConnectionInfo (org.apache.activemq.command.ConnectionInfo)1 StubTransportListener (org.apache.activemq.transport.StubTransportListener)1 ObjectStreamWireFormat (org.apache.activemq.wireformat.ObjectStreamWireFormat)1