### Question:
StandardServiceAgentClient implements ServiceAgentClient { public static StandardServiceAgentClient newInstance(Settings settings) { UDPConnector.Factory udpFactory = Factories.newInstance(settings, UDP_CONNECTOR_FACTORY_KEY); TCPConnector.Factory tcpFactory = Factories.newInstance(settings, TCP_CONNECTOR_FACTORY_KEY); return new StandardServiceAgentClient(udpFactory.newUDPConnector(settings), tcpFactory.newTCPConnector(settings), settings); } StandardServiceAgentClient(UDPConnector udpConnector, TCPConnector tcpConnector);  StandardServiceAgentClient(UDPConnector udpConnector, TCPConnector tcpConnector, Settings settings); static StandardServiceAgentClient newInstance(Settings settings); int getPort(); void setPort(int port); String getConnectAddress(); void setConnectAddress(String connectAddress); boolean isUnicastPreferTCP(); void setUnicastPreferTCP(boolean preferTCP); void register(ServiceInfo service); void addAttributes(ServiceURL serviceURL, String language, Attributes attributes); void removeAttributes(ServiceURL serviceURL, String language, Attributes attributes); void deregister(ServiceURL serviceURL, String language);  }### Answer:
@Test public void testUseUDP() { Settings settings = newSettings(); UDPConnectorServer.Factory udpServerFactory = Factories.newInstance(settings, UDP_CONNECTOR_SERVER_FACTORY_KEY); Settings saSettings = newSettings(); saSettings.put(SA_UNICAST_PREFER_TCP, false); testUnicast(udpServerFactory.newUDPConnectorServer(settings), saSettings); }
@Test public void testUseTCP() { Settings settings = newSettings(); TCPConnectorServer.Factory tcpServerFactory = Factories.newInstance(settings, TCP_CONNECTOR_SERVER_FACTORY_KEY); Settings saSettings = newSettings(); saSettings.put(SA_UNICAST_PREFER_TCP, true); saSettings.put(TCP_READ_TIMEOUT_KEY, 500); testUnicast(tcpServerFactory.newTCPConnectorServer(settings), saSettings); }