@Test public void testCanUpgrade() { final Transport transport = Mockito.spy(new StubTransport()); final EngineIoServer server = new EngineIoServer(); final EngineIoSocket socket = new EngineIoSocket(new Object(), ServerYeast.yeast(), server, mPingTimeoutHandler); socket.init(transport, null); Mockito.doAnswer(invocationOnMock -> Polling.NAME).when(transport).getName(); Assert.assertFalse(socket.canUpgrade(Polling.NAME)); Assert.assertTrue(socket.canUpgrade(WebSocket.NAME)); }
@SuppressWarnings("SameParameterValue") boolean canUpgrade(String transport) { return (!mUpgrading.get() && mTransport.getName().equals(Polling.NAME) && transport.equals(WebSocket.NAME)); }
EngineIoSocket extends Emitter { @SuppressWarnings("SameParameterValue") boolean canUpgrade(String transport) { return (!mUpgrading.get() && mTransport.getName().equals(Polling.NAME) && transport.equals(WebSocket.NAME)); } }
EngineIoSocket extends Emitter { @SuppressWarnings("SameParameterValue") boolean canUpgrade(String transport) { return (!mUpgrading.get() && mTransport.getName().equals(Polling.NAME) && transport.equals(WebSocket.NAME)); } EngineIoSocket(Object lockObject, String sid, EngineIoServer server, EngineIoSocketTimeoutHandler pingTimeoutHandler); }
EngineIoSocket extends Emitter { @SuppressWarnings("SameParameterValue") boolean canUpgrade(String transport) { return (!mUpgrading.get() && mTransport.getName().equals(Polling.NAME) && transport.equals(WebSocket.NAME)); } 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 { @SuppressWarnings("SameParameterValue") boolean canUpgrade(String transport) { return (!mUpgrading.get() && mTransport.getName().equals(Polling.NAME) && transport.equals(WebSocket.NAME)); } EngineIoSocket(Object lockObject, String sid, EngineIoServer server, EngineIoSocketTimeoutHandler pingTimeoutHandler); @SuppressWarnings("WeakerAccess") String getId(); @SuppressWarnings("WeakerAccess") ReadyState getReadyState(); void send(Packet<?> packet); void close();  }