### Question:
Transport extends Emitter { protected void onData(Object data) { onPacket(ServerParser.decodePacket(data)); } protected  Transport(); abstract void onRequest(HttpServletRequest request, HttpServletResponse response); abstract void send(List<Packet<?>> packets); abstract boolean isWritable(); abstract String getName(); void close();  }### Answer:
@Test public void testOnData() { final TestTransport transport = Mockito.spy(new TestTransport()); final Packet<?> testPacket = new Packet<>(Packet.MESSAGE, "test"); ServerParser.encodePacket(testPacket, false, data -> { String packetData = (String) data; transport.onData(packetData); Mockito.verify(transport, Mockito.times(1)).onPacket(Mockito.any(Packet.class)); }); }