title: What is the most accurate way to test the networking code on Linux?
body: <p>I want to cover my code with unit-tests. That's a good thing. But I have a problem - I have a networking code. The code does resolve IPv4 and IPv6 addresses from hostnames, binds to interfaces, listens, connects, etc.</p>
  
  <p>I assume that there exists some C/C++ test framework that can be deployed on almost any workstation or some programming technique that allows me to:</p>
  
  <ul>
  <li>set up and tear down custom network interfaces with IPv4 and IPv6 addresses</li>
  <li>emulate different jamming behavior, like losing packets, timeouting, connection dropping, etc.</li>
  <li>bind hostnames to interfaces and resolve them.</li>
  </ul>
  
  <p>The main goal is not to interact or mess with a real network interfaces on machine.</p>
  
  <hr>
  
  <p>What can you advise?</p>