Check that you avoid URL DNS hazards with URI, bound connect/read timeouts, frame TCP payloads cleanly, and drive HttpClient sync/async requests and HttpServer.
More lessons in Complete Core Java