Beispiel #1
0
def create_connections_manager(multiplexer_password=None):
    welcome = WelcomeMessage()
    welcome.id = 547
    welcome.type = 115
    if multiplexer_password is not None:
        welcome.multiplexer_password = multiplexer_password
    welcome_message = MultiplexerMessage()
    welcome_message.from_ = 547
    welcome_message.message = welcome.SerializeToString()
    welcome_message.type = MessageTypes.CONNECTION_WELCOME
    return ConnectionsManager(welcome_message=welcome_message, multiplexer_password=multiplexer_password)
Beispiel #2
0
def test_serialize():
    # The order of serialized fields is not guaranteed, so we can check
    # serialization using one field only.
    msg = MultiplexerMessage()
    msg.type = 3 # This should be the only required field.
    assert msg.SerializeToString() == ' \x03'