@Override
	public boolean onMessage(Message<?> message) {
		String payload = new String((byte[]) message.getPayload());
		if (payload.startsWith("login")) {
			String[] items = payload.split("[:;]");
			if (items.length == 3) {
				String userName = items[1];
				String password = items[2];
				boolean authenticated = this.authentication.authenticate(
						userName, password);
				String msg = null;
				if (authenticated) {
					this.authenticated = authenticated;
					this.userName = userName;
					msg = "logined";
				} else {
					msg = "wrong user name or password";
				}
				try {
					super.send(MessageBuilder.withPayload(msg).build());
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}

			}
		} else if (payload.startsWith("logout")) {
			super.close();
		} else {
			if (authenticated) {
				MessageBuilder<String> builder = MessageBuilder
						.withPayload(payload);
				builder.copyHeaders(message.getHeaders()).setHeader("userName",
						this.userName);
				return super.onMessage(builder.build());

			} else {
				try {
					super.send(new GenericMessage<String>(
							"Have not login yet. please login with login:username:password"));
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}

			}
		}
		return true;

	}