Esempio n. 1
0
 def _connect(self):
     """Send connect command
     """
     self.log.debug('Sending connect command')
     cmd = stomper.connect(self.factory.login, self.factory.passcode)
     # self.log.debug('Writing cmd: %s' % cmd)
     self.transport.write(cmd)
Esempio n. 2
0
 def _connect(self):
     """Send connect command
     """
     self.log.debug("Sending connect command")
     cmd = stomper.connect(self.factory.getLogin(), self.factory.getPasscode())
     # self.log.debug("Writing cmd: %s" % cmd)
     self.transport.write(cmd)
Esempio n. 3
0
 def connectionMade(self):
     """Register with stomp server.
     """
     print "connect made .."
     cmd = stomper.connect(self.username, self.password, self.host)
     print "cmd is-------->",
     self.transport.write(cmd)
Esempio n. 4
0
    def login(self):
        credentials = self.credentials
        self.instanceId = credentials['username']
        host = self.locust.host
        """Create random credentials"""
        user_pass = credentials['username'] + ":" + credentials['password']
        encoded_user_pass = b64encode(
            user_pass.encode('ascii')).decode("utf-8")
        """Create connection"""
        init_time = time.time()
        ws_url = "ws://" + host + "/device-management-service/websocket"
        ws = create_connection(
            ws_url,
            header={"Authorization": "Basic " + str(encoded_user_pass)})

        con = stomper.connect(credentials["username"],
                              credentials["password"],
                              host=ws_url,
                              heartbeats=(30000, 30000))
        ws.send(con)

        res = ws.recv()
        self.handle_message(str(res), init_time=init_time)
        """subscribe"""
        init_time = time.time()
        sub = stomper.subscribe("/user/queue/device", 0, ack='auto')
        ws.send(sub)

        res = ws.recv()
        self.handle_message(str(res), init_time=init_time)

        return ws
Esempio n. 5
0
 def connect(self, login='', passcode=''):
     self._socketConnect()
     self._write(stomper.connect(login, passcode))
     frame = self.receiveFrame()
     if frame['cmd'] == 'CONNECTED':
         return frame
     raise StompProtocolError('Unexpected frame received: %s' % frame)
Esempio n. 6
0
 def connectionMade(self):
   """
   Called when a connection is made. 
   Protocol initialization happens here
   """
   self.logger.info("Connection with the broker made")
   stompConnectMsg = stomper.connect(self._username, self._password)
   self.transport.write(stompConnectMsg)
  def test_connectionMade(self):
    self.protocol.makeConnection( self.fakeTransport )
    #the protocol must have sent the request for login to 
    #the STOMP broker

    dataInTheWire = self.fakeTransport.value()
    expected = stomper.connect(config.USER, config.PASS)

    self.assertEquals(expected, dataInTheWire)
Esempio n. 8
0
    def test_connectionMade(self):
        self.protocol.makeConnection(self.fakeTransport)
        #the protocol must have sent the request for login to
        #the STOMP broker

        dataInTheWire = self.fakeTransport.value()
        expected = stomper.connect(config.USER, config.PASS)

        self.assertEquals(expected, dataInTheWire)
Esempio n. 9
0
 def testConnectWithHeartbeats(self):
     username, password = '******', '123'
     heartbeats = (1000, 1000)
     correct = "CONNECT\naccept-version:1.1\nhost:localhost\nheart-beat:1000,1000\nlogin:%s\npasscode:%s\n\n\x00\n" % (
         username, password)
     self.assertEquals(
         stomper.connect(username,
                         password,
                         'localhost',
                         heartbeats=heartbeats), correct)
Esempio n. 10
0
    def test_processLine_throws_FrameError_after_done(self):
        cmd = stomper.connect('foo', 'bar')
        lines = cmd.split('\n')[:-1]

        parser = StompFrameLineParser()
        for line in lines:
            parser.processLine(line)
            
        self.assertTrue(parser.isDone())
        self.assertRaises(StompFrameError, lambda: parser.processLine('SEND'))
  def connectionMade(self):
    """
    Called when a connection is made. 
    Protocol initialization happens here
    """
    self.logger.info("Connection with the broker made")
    stompConnectMsg = stomper.connect(self._username, self._password)
    self.sendMsg(stompConnectMsg)

    try:
      self.factory.resetDelay()
    except:
      pass
Esempio n. 12
0
    def connectionMade(self):
        """
        Called when a connection is made. 
        Protocol initialization happens here
        """
        self.logger.info("Connection with the broker made")
        stompConnectMsg = stomper.connect(self._username, self._password)
        self.sendMsg(stompConnectMsg)

        try:
            self.factory.resetDelay()
        except:
          pass
Esempio n. 13
0
def on_open(ws, c=config):
    print('on_open:', 'Connection opened!')
    connDATA = c.getConf()
    """
    stomp connect()
    lo interesante de marcar aqui son los parametos de conexion.
    Como podemos ver mandar fruta e igualmente se conecta.
    Funciona xq websockets ya tiene la conexion abierta.
    El connect del stomp es puramente formal 
    """
    msg = stomper.connect('DUMMY_USER', 'DUMMY_PW', 'DUMMY_HOST', (0,0))
    print('stomp connect:', msg)
    ws.send(msg)

    f = stomper.Frame()
    f.unpack(stomper.subscribe(connDATA['endpoint']['bymaMD'], 'bymaMD', ack='auto'))
    fMsg = f.pack()
    ws.send(fMsg)
Esempio n. 14
0
 def testConnectWithHeartbeats(self):
     username, password = '******', '123'
     heartbeats = (1000, 1000)
     correct = "CONNECT\naccept-version:1.1\nhost:localhost\nheart-beat:1000,1000\nlogin:%s\npasscode:%s\n\n\x00\n" % (username, password)
     self.assertEquals(stomper.connect(username, password, 'localhost', heartbeats=heartbeats), correct)
Esempio n. 15
0
#!/usr/bin/python
import stomper
stomper.connect()
Esempio n. 16
0
 def connect(self):
     cmd = stomper.connect(self.username, self.password, self.server)
     self._send(cmd)
Esempio n. 17
0
 def connectionMade(self):
     cmd = stomper.connect(self.username, self.password)
     self.transport.write(cmd)
Esempio n. 18
0
 def testConnect(self):
     username, password = '******', '123'
     correct = "CONNECT\naccept-version:1.1\nhost:localhost\nheart-beat:0,0\nlogin:%s\npasscode:%s\n\n\x00\n" % (
         username, password)
     self.assertEquals(stomper.connect(username, password, 'localhost'),
                       correct)
Esempio n. 19
0
 def connectionMade(self):
     cmd = stomper.connect(self.username, self.password)
     self.transport.write(cmd)
Esempio n. 20
0
 def connect(self):
     """Generate the STOMP connect command to get a session.
     """
     return stomper.connect(self.username, self.password)
Esempio n. 21
0
 def connectionMade(self):
     """Register with stomp server.
     """
     cmd = stomper.connect(self.username, self.password)
     self.transport.write(cmd)
Esempio n. 22
0
 def testConnect(self):
     username, password = '******', '123'
     correct = "CONNECT\nlogin:%s\npasscode:%s\n\n\x00\n" % (username,
                                                             password)
     self.assertEquals(stomper.connect(username, password), correct)
Esempio n. 23
0
	def connect(self):
		"""Generate the STOMP connect command to get a session."""
		self.pygo_mp.logger.info("=> PyGoWave RPC Server starting <=")
		return stomper.connect(self.username, self.password)
Esempio n. 24
0
 def conectar(self):
     # Generate the STOMP connect command to get a session.
     return stomper.connect(self.username, self.password, 'localhost')
Esempio n. 25
0
 def testConnect(self):
     username, password = '******', '123'
     correct = "CONNECT\nlogin:%s\npasscode:%s\n\n\x00\n" % (username, password)
     self.assertEquals(stomper.connect(username, password), correct)
Esempio n. 26
0
#!/usr/bin/env python


import stomper

ch = stomper.connect("", "", "172.17.5.194")

stomper.send(ch, "hello")

print ch
Esempio n. 27
0
 def connect(self):
     """Generate the STOMP connect command to get a session.
     """
     return stomper.connect(self.username, self.password)
Esempio n. 28
0
messages and anything else I can think of demonstrating.

(c) Oisin Mulvihill, 2007-07-28.
License: http://www.apache.org/licenses/LICENSE-2.0

"""
from __future__ import print_function
import pprint

import stomper


responder = stomper.Engine()

# Generate the connect command to tell the server about us:
msg = stomper.connect('bob','1234')
print("msg:\n%s\n" % pprint.pformat(msg))

#>>> 'CONNECT\nlogin:bob\npasscode:1234\n\n\x00\n'

# Send the message to the server and you'll get a response like:
#
server_response = """CONNECTED
session:ID:snorky.local-49191-1185461799654-3:18

\x00
"""


# We can react to this using the state machine to generate a response.
#
Esempio n. 29
0
 def connectionMade(self):
     """Register with stomp server.
     """
     cmd = stomper.connect(self.username, self.password)
     self.transport.write(cmd)
Esempio n. 30
0
 def testConnect(self):
     username, password = '******', '123'
     correct = "CONNECT\naccept-version:1.1\nhost:localhost\nheart-beat:0,0\nlogin:%s\npasscode:%s\n\n\x00\n" % (username, password)
     self.assertEquals(stomper.connect(username, password, 'localhost'), correct)