Ejemplo n.º 1
0
def test_stomp_ssl(manager, watcher, tmpdir, context):
    """ test ssl connection """
    port = 61614

    if context:
        context.check_hostname = True
        context.verify_mode = ssl.CERT_REQUIRED
    else:
        # Run like older Python version w/out ssl context
        pass

    app = App(QUEUE).register(manager)
    client = StompClient(URI, port,
                         username=LOGIN,
                         password=PASSCODE,
                         ssl_context=context).register(app)

    watcher.wait("registered")
    client.fire(connect(host=HOST))
    watcher.wait("connected")

    client.fire(subscribe(QUEUE, ack=ACK_AUTO))
    watcher.wait("subscribe_success")

    client.fire(send(headers=None,
                     body=TEST_MESSAGE,
                     destination=QUEUE))
    watcher.wait("message_success")
    client.fire(disconnect())
    received = app.received[0].decode()
    assert received == TEST_MESSAGE

    client.unregister()
    app.unregister()
    watcher.wait("unregistered")
Ejemplo n.º 2
0
def test_stomp_proxy_no_ssl(manager, watcher, tmpdir):
    """ Test plain tcp connection through http proxy"""
    port = 61613

    app = App(QUEUE).register(manager)
    client = StompClient(URI, port,
                         username=LOGIN,
                         password=PASSCODE,
                         proxy_host=PROXY_HOST,
                         proxy_port=PROXY_PORT,
                         use_ssl=False).register(app)

    watcher.wait("registered")
    client.fire(connect(host=HOST))
    app.wait("connected")

    client.fire(subscribe(QUEUE, ack=ACK_AUTO))
    watcher.wait("subscribe_success")

    client.fire(send(headers=None,
                body=TEST_MESSAGE,
                destination=QUEUE))
    watcher.wait("message_success")
    client.fire(disconnect())
    received = app.received[0].decode()
    assert received == TEST_MESSAGE

    client.unregister()
    app.unregister()
    watcher.wait("unregistered")
Ejemplo n.º 3
0
def test_stomp_no_ssl(manager, watcher, tmpdir):
    """ Test plain tcp connection """
    port = 61613

    app = App(QUEUE).register(manager)
    client = StompClient(URI,
                         port,
                         username=LOGIN,
                         password=PASSCODE,
                         use_ssl=False).register(app)

    watcher.wait("registered")
    client.fire(connect(host=HOST))
    app.wait("connected")

    client.fire(subscribe(QUEUE, ack=ACK_AUTO))
    watcher.wait("subscribe_success")

    client.fire(send(headers=None, body=TEST_MESSAGE, destination=QUEUE))
    watcher.wait("message_success")
    client.fire(disconnect())
    received = app.received[0].decode()
    assert received == TEST_MESSAGE

    client.unregister()
    app.unregister()
    watcher.wait("unregistered")
Ejemplo n.º 4
0
def test_stomp_ssl(manager, watcher, tmpdir, context):
    """ test ssl connection """
    port = 61614

    if context:
        context.check_hostname = True
        context.verify_mode = ssl.CERT_REQUIRED
    else:
        # Run like older Python version w/out ssl context
        pass

    app = App(QUEUE).register(manager)
    client = StompClient(URI,
                         port,
                         username=LOGIN,
                         password=PASSCODE,
                         ssl_context=context).register(app)

    watcher.wait("registered")
    client.fire(connect(host=HOST))
    watcher.wait("connected")

    client.fire(subscribe(QUEUE, ack=ACK_AUTO))
    watcher.wait("subscribe_success")

    client.fire(send(headers=None, body=TEST_MESSAGE, destination=QUEUE))
    watcher.wait("message_success")
    client.fire(disconnect())
    received = app.received[0].decode()
    assert received == TEST_MESSAGE

    client.unregister()
    app.unregister()
    watcher.wait("unregistered")
Ejemplo n.º 5
0
 def connected(self):
     self.fire(subscribe(self.queue, ack=ACK_AUTO))
     print("connected")
Ejemplo n.º 6
0
 def connected(self):
     self.fire(subscribe(self.queue, ack=ACK_AUTO))
     print("connected")
Ejemplo n.º 7
0
 def connected(self):
     """Client has connected to the STOMP server"""
     LOG.info("STOMP connected.")
     # Let's subscribe to the message destination
     self.fire(subscribe(self.queue, ack=ACK_AUTO))
Ejemplo n.º 8
0
 def connected(self):
     """Client has connected to the STOMP server"""
     LOG.info("STOMP connected.")
     # Let's subscribe to the message destination
     self.fire(subscribe(self.queue, ack=ACK_AUTO))