### Question:
Transport extends Emitter { protected void onError(String reason, String description) { if(this.listeners("error").size() > 0) { emit("error", reason, description); } } 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 testOnError() { final TestTransport transport = Mockito.spy(new TestTransport()); transport.on("error", args -> { }); transport.onError("test", null); Mockito.verify(transport, Mockito.times(1)).emit("error", "test", null); }