In this module we introduce the basic concepts behind networking. We use Java's networking libraries to design simple programs that interact with web pages as well as write simple client-server programs.

We conclude this module with an introduction to Mocking and Mockito. We show how to use mocking of objects in your tests in order to simulate the behavior of dependent code, and assist with unit tests.

  1. Given a URL, identify each component.
  2. Explain the difference between a server socket and a normal socket.
  3. Write a program that reads the contents of a public web page by using the Java HttpURLConnection class.
  4. Write a server-client program that uses Java sockets to exchange data.
  5. Given a Java application, use Maven to introduce a new library dependency.
  6. Given a Java class with dependencies, mock all dependency calls in a JUnit test by using the Mockito library.