### Question:
EndpointServer { @Override public String toString() { if (mHost != null && (!mNetwork.equalsIgnoreCase(mHost) || mPort != DEFAULT_PORT)) { String out = mNetwork + "|" + mHost; if (mPort != DEFAULT_PORT) out += ":" + mPort; return out; } else { return mNetwork; } } EndpointServer(String url);  EndpointServer(String network, String host, int port); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); String getHost(); int getPort(); int getSecurePort(); String getNetwork(); static boolean validate(String value); static final int DEFAULT_PORT; }### Answer:
@Test public void testToString() throws Exception { EndpointServer s; s = new EndpointServer("beta.kontalk.net"); assertEquals("beta.kontalk.net", s.toString()); s = new EndpointServer("beta.kontalk.net|127.0.0.1"); assertEquals("beta.kontalk.net|127.0.0.1", s.toString()); s = new EndpointServer("beta.kontalk.net|127.0.0.1:5999"); assertEquals("beta.kontalk.net|127.0.0.1:5999", s.toString()); }