@Override
	public boolean join(String n) {
		try {
			// Create a connection, for send messages, with the server
			ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(K.BROKER_URL);
			m_connection = (ActiveMQConnection) cf.createConnection();

			m_connection.start();

			// Setup the connection
			m_qSession = m_connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
			m_queue = m_qSession.createQueue(K.QUEUE_NAME);
			m_sender = m_qSession.createSender(m_queue);

			System.out.println("[CLIENT] Queue created, creating message ...");
			// Create join message
			ObjectMessage oMsg = m_qSession.createObjectMessage(new Join(n));

			System.out.print("[CLIENT] Sending message ...");
			// Send message to server
			m_sender.send(oMsg);
			System.out.print(" ok.\n");

			// The client wait for a response in a queue named like username
			Queue response = m_qSession.createQueue(n);
			QueueReceiver receiver = m_qSession.createReceiver(response);

			System.out.print("[CLIENT] Wait for a response ...");
			oMsg = (ObjectMessage) receiver.receive();
			System.out.print("received\n");
			
			if (oMsg.getObject() instanceof JoinResponse) {
				JoinResponse resp = (JoinResponse) oMsg.getObject();
				if (!resp.accepted()){
					System.out.println("[CLIENT] Connecton refused.");
					receiver.close();
					return false;
				}
				else {
					System.out.print("[CLIENT] Subscribing the topic ...");
					// Subscribe the topic and process the history
					m_tSession = m_connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
					m_topic = m_tSession.createTopic(resp.getTopicName());
					m_sub = m_tSession.createSubscriber(m_topic);
					m_histo = resp.getHistory();
					System.out.print("subscribed\n");
					receiver.close();
					return true;
				}
			} else
				return false;

		} catch (JMSException e) {
			e.printStackTrace();
		}
		return false;
	}