Implemented NetworkClientTest class.

Fixed bugs in asynchronous application closing.