Added exception handling in TcpListener.java