### Question:
EngineIoSocket extends Emitter { void onRequest(HttpServletRequest request, HttpServletResponse response) throws IOException { mTransport.onRequest(request, response); if (mUpgrading.get() && mTransport.isWritable() && mWriteBuffer.isEmpty()) mTransport.send(PAYLOAD_NOOP); } EngineIoSocket(Object lockObject, String sid, EngineIoServer server, EngineIoSocketTimeoutHandler pingTimeoutHandler); @SuppressWarnings("WeakerAccess") String getId(); @SuppressWarnings("WeakerAccess") ReadyState getReadyState(); void send(Packet<?> packet); void close();  }### Answer:
@Test public void testOnRequest() throws IOException { final Transport transport = Mockito.spy(new StubTransport()); final EngineIoSocket socket = new EngineIoSocket(new Object(), ServerYeast.yeast(), new EngineIoServer(), mPingTimeoutHandler); socket.init(transport, null); final HttpServletRequest request = Mockito.mock(HttpServletRequest.class); final HttpServletResponse response = Mockito.mock(HttpServletResponse.class); socket.onRequest(request, response); Mockito.verify(transport, Mockito.times(1)) .onRequest(Mockito.eq(request), Mockito.eq(response)); }