make use of blocking API

got rid of calling Thead.sleep(ms) when listening for data, and modified
handleData() to make use of existing blocking methods