### Question:
ColocOutInterceptor extends AbstractPhaseInterceptor<Message> { protected void invokeInboundChain(Exchange ex, Endpoint ep) { Message m = getInBoundMessage(ex); Message inMsg = ep.getBinding().createMessage(); MessageImpl.copyContent(m, inMsg); inMsg.putAll(m); inMsg.put(Message.REQUESTOR_ROLE, Boolean.TRUE); inMsg.put(Message.INBOUND_MESSAGE, Boolean.TRUE); inMsg.setExchange(ex); Exception exc = inMsg.getContent(Exception.class); if (exc != null) { ex.setInFaultMessage(inMsg); ColocInFaultObserver observer = new ColocInFaultObserver(bus); observer.onMessage(inMsg); } else { ex.setInMessage(inMsg); PhaseManager pm = bus.getExtension(PhaseManager.class); SortedSet<Phase> phases = new TreeSet<>(pm.getInPhases()); ColocUtil.setPhases(phases, Phase.USER_LOGICAL, Phase.PRE_INVOKE); InterceptorChain chain = ColocUtil.getInInterceptorChain(ex, phases); inMsg.setInterceptorChain(chain); chain.doIntercept(inMsg); } ex.put(ClientImpl.FINISHED, Boolean.TRUE); } ColocOutInterceptor();  ColocOutInterceptor(Bus b); void setBus(Bus bus); void handleMessage(Message message); void setExchangeProperties(Exchange exchange, Endpoint ep);  }### Answer:
@Test public void testInvokeInboundChain() { msg.setExchange(null); Bus bus = setupBus(); colocOut.setBus(bus); PhaseManager pm = new PhaseManagerImpl(); EasyMock.expect(bus.getExtension(PhaseManager.class)).andReturn(pm).times(2); Endpoint ep = control.createMock(Endpoint.class); Binding bd = control.createMock(Binding.class); Service srv = control.createMock(Service.class); ex.setInMessage(msg); ex.put(Bus.class, bus); ex.put(Endpoint.class, ep); ex.put(Service.class, srv); EasyMock.expect(ep.getBinding()).andReturn(bd); EasyMock.expect(bd.createMessage()).andReturn(new MessageImpl()); EasyMock.expect(ep.getInInterceptors()) .andReturn(new ArrayList<Interceptor<? extends Message>>()).atLeastOnce(); EasyMock.expect(ep.getService()).andReturn(srv).atLeastOnce(); EasyMock.expect(srv.getInInterceptors()) .andReturn(new ArrayList<Interceptor<? extends Message>>()).atLeastOnce(); EasyMock.expect(bus.getInInterceptors()) .andReturn(new ArrayList<Interceptor<? extends Message>>()).atLeastOnce(); control.replay(); colocOut.invokeInboundChain(ex, ep); Message inMsg = ex.getInMessage(); assertNotSame(msg, inMsg); assertTrue("Requestor role should be set to true.", (Boolean)inMsg.get(Message.REQUESTOR_ROLE)); assertTrue("Inbound Message should be set to true.", (Boolean)inMsg.get(Message.INBOUND_MESSAGE)); assertNotNull("Inbound Message should have interceptor chain set.", inMsg.getInterceptorChain()); assertTrue("Client Invoke state should be FINISHED", (Boolean)ex.get(ClientImpl.FINISHED)); control.verify(); }