### Question:
WebSocket extends Transport { @Override protected void doClose() { mConnection.close(); } WebSocket(EngineIoWebSocket webSocket); @Override void onRequest(HttpServletRequest request, HttpServletResponse response); @Override void send(List<Packet<?>> packets); @Override boolean isWritable(); @Override String getName(); static final String NAME; }### Answer:
@Test public void testClose() { final EngineIoWebSocket webSocketConnection = Mockito.mock(EngineIoWebSocket.class); final WebSocket webSocket = Mockito.spy(new WebSocket(webSocketConnection)); webSocket.close(); Mockito.verify(webSocket, Mockito.times(1)) .doClose(); Mockito.verify(webSocketConnection, Mockito.times(1)) .close(); }