### Question:
EngineIoSocket extends Emitter { public void send(Packet<?> packet) { sendPacket(packet); } EngineIoSocket(Object lockObject, String sid, EngineIoServer server, EngineIoSocketTimeoutHandler pingTimeoutHandler); @SuppressWarnings("WeakerAccess") String getId(); @SuppressWarnings("WeakerAccess") ReadyState getReadyState(); void send(Packet<?> packet); void close();  }### Answer:
@SuppressWarnings({"Duplicates", "unchecked"}) @Test public void testSend() { final Transport transport = Mockito.spy(new StubTransport()); final EngineIoSocket socket = new EngineIoSocket(new Object(), ServerYeast.yeast(), new EngineIoServer(), mPingTimeoutHandler); socket.init(transport, null); final Packet<String> packet = new Packet<>(Packet.MESSAGE, "TestMessage"); Mockito.doAnswer(invocationOnMock -> { List<Packet<?>> packets = (List<Packet<?>>) invocationOnMock.getArguments()[0]; Assert.assertEquals(1, packets.size()); Assert.assertEquals(packet, packets.get(0)); return null; }).when(transport).send(Mockito.anyList()); socket.send(packet); Mockito.verify(transport, Mockito.times(2)) .send(Mockito.anyList()); }