StandaloneConsumer implements AdaptrisMessageConsumer, StateManagedComponent, ComponentLifecycleExtension { public void setConnection(AdaptrisConnection conn) { connection = Args.notNull(conn, "connection"); } StandaloneConsumer();  StandaloneConsumer(AdaptrisMessageConsumer consumer);  StandaloneConsumer(AdaptrisConnection c);  StandaloneConsumer(AdaptrisConnection c, AdaptrisMessageConsumer amc); @Override void init(); @Override void start(); @Override void stop(); @Override void close(); @Override T retrieveConnection(Class<T> type); @Override String createQualifier(); @Override String getUniqueId(); AdaptrisConnection getConnection(); void setConnection(AdaptrisConnection conn); @Override void registerConnection(AdaptrisConnection conn); AdaptrisMessageConsumer getConsumer(); void setConsumer(AdaptrisMessageConsumer cons); @Override void registerAdaptrisMessageListener(AdaptrisMessageListener l); @Override AdaptrisMessageEncoder getEncoder(); @Override void setEncoder(AdaptrisMessageEncoder encoder); @Override void handleConnectionException(); @Override byte[] encode(AdaptrisMessage msg); @Override AdaptrisMessage decode(byte[] bytes); @Override void prepare(); @Override String createName(); Boolean getIsTrackingEndpoint(); void setIsTrackingEndpoint(Boolean b); @Override boolean isTrackingEndpoint(); @Override AdaptrisMessageFactory getMessageFactory(); @Override void setMessageFactory(AdaptrisMessageFactory f); @Override void changeState(ComponentState newState); @Override ComponentState retrieveComponentState(); @Override void requestInit(); @Override void requestStart(); @Override void requestStop(); @Override void requestClose();  }
@Test public void testSetConnection() throws Exception { NullConnection c = new NullConnection(); StandaloneConsumer sc = new StandaloneConsumer(c); assertEquals(c, sc.getConnection()); try { sc.setConnection(null); fail(); } catch (IllegalArgumentException expected) { } assertEquals(c, sc.getConnection()); }