### Question:
WebSocketServiceImpl implements WebSocketService { public static WebSocketService create(URI uri) throws WebSocketServiceException { WebSocketServiceImpl webSocketService = new WebSocketServiceImpl(); webSocketService.connect(uri); return webSocketService; } WebSocketServiceImpl(Session session); private  WebSocketServiceImpl(); static WebSocketService create(URI uri); @Override void connect(URI uri); @Override void send(String message); @Override void addMessageHandler(Consumer<String> consumer); @Override void close(); @Override boolean closed(); @SuppressWarnings("unchecked") static WebSocketContainer getWebSocketContainer(); static final String WEB_SOCKET_CONTAINER_FACTORY_PROPERTY; }### Answer:
@Test(expected = WebSocketServiceException.class) public void testConnectionOnNonExistentServer() throws WebSocketServiceException, InterruptedException { final int port = randomPort(); WebSocketServiceImpl.create(createURI(port)); }