@Test public void testGetTransportWithLinkContext() { Transport transport = Transport.Factory.create(); Connection connection = Connection.Factory.create(); transport.bind(connection); Session session = connection.session(); Link link = session.receiver("myReceiver"); EventImpl event = createEvent(link, Event.Type.LINK_INIT); assertNotNull("No transport returned", event.getTransport()); assertSame("Incorrect transport returned", transport, event.getTransport()); }
@Override public Transport getTransport() { if (context instanceof Transport) { return (Transport) context; } else if (context instanceof Connection) { return ((Connection)context).getTransport(); } else { Session session = getSession(); if (session == null) { return null; } Connection connection = session.getConnection(); if (connection == null) { return null; } return connection.getTransport(); } }
EventImpl implements Event { @Override public Transport getTransport() { if (context instanceof Transport) { return (Transport) context; } else if (context instanceof Connection) { return ((Connection)context).getTransport(); } else { Session session = getSession(); if (session == null) { return null; } Connection connection = session.getConnection(); if (connection == null) { return null; } return connection.getTransport(); } } }
EventImpl implements Event { @Override public Transport getTransport() { if (context instanceof Transport) { return (Transport) context; } else if (context instanceof Connection) { return ((Connection)context).getTransport(); } else { Session session = getSession(); if (session == null) { return null; } Connection connection = session.getConnection(); if (connection == null) { return null; } return connection.getTransport(); } } EventImpl(); }
EventImpl implements Event { @Override public Transport getTransport() { if (context instanceof Transport) { return (Transport) context; } else if (context instanceof Connection) { return ((Connection)context).getTransport(); } else { Session session = getSession(); if (session == null) { return null; } Connection connection = session.getConnection(); if (connection == null) { return null; } return connection.getTransport(); } } EventImpl(); @Override EventType getEventType(); @Override Type getType(); @Override Object getContext(); @Override Handler getRootHandler(); @Override void dispatch(Handler handler); @Override void delegate(); @Override void redispatch(EventType as_type, Handler handler); @Override Connection getConnection(); @Override Session getSession(); @Override Link getLink(); @Override Sender getSender(); @Override Receiver getReceiver(); @Override Delivery getDelivery(); @Override Transport getTransport(); @Override Selectable getSelectable(); @Override Reactor getReactor(); @Override Task getTask(); @Override Record attachments(); @Override Event copy(); @Override String toString(); }
EventImpl implements Event { @Override public Transport getTransport() { if (context instanceof Transport) { return (Transport) context; } else if (context instanceof Connection) { return ((Connection)context).getTransport(); } else { Session session = getSession(); if (session == null) { return null; } Connection connection = session.getConnection(); if (connection == null) { return null; } return connection.getTransport(); } } EventImpl(); @Override EventType getEventType(); @Override Type getType(); @Override Object getContext(); @Override Handler getRootHandler(); @Override void dispatch(Handler handler); @Override void delegate(); @Override void redispatch(EventType as_type, Handler handler); @Override Connection getConnection(); @Override Session getSession(); @Override Link getLink(); @Override Sender getSender(); @Override Receiver getReceiver(); @Override Delivery getDelivery(); @Override Transport getTransport(); @Override Selectable getSelectable(); @Override Reactor getReactor(); @Override Task getTask(); @Override Record attachments(); @Override Event copy(); @Override String toString();  }