@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)); }
void onRequest(HttpServletRequest request, HttpServletResponse response) throws IOException { mTransport.onRequest(request, response); if (mUpgrading.get() && mTransport.isWritable() && mWriteBuffer.isEmpty()) mTransport.send(PAYLOAD_NOOP); }
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 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); }
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(); }
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();  }