### Question:
Connection implements Cloneable { @Override public String toString() { StringBuilder bldr = new StringBuilder("c="); bldr.append(networkType).append(" "); bldr.append(getAddressType()).append(" "); bldr.append(address.getHostAddress()); if (address.isMulticastAddress()) { bldr.append("/").append(ttl); if (numOfAddresses > 1) bldr.append("/").append(numOfAddresses); } bldr.append("\r\n"); return bldr.toString(); } Connection(InetAddress address); InetAddress getAddress(); void setAddress(InetAddress address); String getNetworkType(); void setNetworkType(String networkType); String getAddressType(); int getNumOfAddresses(); void setNumOfAddresses(int numOfAddresses); int getTtl(); void setTtl(int ttl); @Override String toString(); @Override Connection clone(); static Connection parse(String line); static final String NETWORK_TYPE_INTERNET; }### Answer:
@Test public void testToString() throws UnknownHostException { System.out.println("SDP connection toString test..."); Connection c = new Connection(InetAddress.getByName("127.0.0.1")); assertEquals("c=IN IP4 127.0.0.1\r\n", c.toString()); }