@Override
	public void run() {
		serverState.notifyAllListener(BTServerStateObservable.SERVER_LISTENING);
		
		

		try {
			
			
			String uri = "btspp://localhost:" + new UUID(btservice.getServiceUUID(),false).toString()
					+ ";name=" + btservice.getServiceName()+";authenticate=false;encrypt=false;master=false";
			streamConnectionNotifier = (StreamConnectionNotifier) Connector
					.open(uri);
			System.out.println(uri);
			while (active) {
				try {
					serverState.notifyAllListener(BTServerStateObservable.SERVER_WAITING);
					System.out.println("waiting");
					con = (StreamConnection) streamConnectionNotifier.acceptAndOpen();
					System.out.println("accepted");
					serverState.notifyAllListener(BTServerStateObservable.SERVER_ACCEPT);
					BTHandler handler = handlerFactory.createHandler(this);
					this.handler.add(handler);
					handler.init(con);
					// threadPool.execute(handler); //for multiple connection
					// handles
					// handler.run();
					System.out.println("handler init");
					handler.run();
					System.out.println("handler done");
				} catch (IOException e) {
					e.printStackTrace();
				}

			}
			//TODO
			//actually here we would call serverState.notifyAllListener(BTServerStateObservable.SERVER_STOPPED);
			//but due to a bug, we cannot close the inputstream in BTHandler, therefore, the stream never stops until the remote client quits the connection
			//so we ignore this, by setting serverState.notifyAllListener(BTServerStateObservable.SERVER_STOPPED); in stop()
			//but keep in mind that the thread is still open
			//we will refer this as bt_unclosable_bug 
		} catch (IOException e1) {
			serverState.notifyAllListener(BTServerStateObservable.SERVER_ERROR, e1);
			return;
		}

	}