public AppChatExample(String host, int port) {
		// Set up our router object, this is responsible for routing incoming
		// and outgoing messages
		router = new CommandRouter();
		try {
			// setup our socket connection to the tv, but don't connect yet
			conn = new Connection(InetAddress.getByName(host), port, router);

			// Tell out router which network connection to use
			router.setConnection(conn);

			// setup a handler for incoming GrantedSessionCommand message
			// objects
			router.registerCommandSubscriber(new CommandSubscriber(), GrantedSessionCommand.class);

			// Establish a connection
			conn.establish();
			// Since this is the first time we are connecting, we must
			// create a new session
			router.publishCommand(new CreateSessionCommand(APP_ID, CONSUMER_KEY, SECRET, APP_NAME));

			String message = this.getUserInput("Code: ");

			router.publishCommand(new AuthSessionCommand(message, conn.getPeerCertificate()));
		} catch (UnknownHostException e) {
			this.exitWithError("Error resolving " + host);
		} catch (IOException e) {
			this.exitWithError("Problem writing to the network connection");
		} catch (InterruptedException e) {
			this.exitWithError("Problem writing to the network connection");
		}
	}