### Question:
ColocMessageObserver extends ChainInitiationObserver { protected void setExchangeProperties(Exchange exchange, Message m) { exchange.put(Bus.class, bus); exchange.put(Endpoint.class, endpoint); exchange.put(Service.class, endpoint.getService()); exchange.put(Binding.class, endpoint.getBinding()); QName opName = (QName) m.get(Message.WSDL_OPERATION); BindingInfo bi = endpoint.getEndpointInfo().getBinding(); BindingOperationInfo boi = bi.getOperation(opName); if (boi != null && boi.isUnwrapped()) { boi = boi.getWrappedOperation(); } exchange.put(BindingOperationInfo.class, boi); } ColocMessageObserver(Endpoint endpoint, Bus bus); void onMessage(Message m);  }### Answer:
@Test public void testSetExchangeProperties() throws Exception { QName opName = new QName("A", "B"); msg.put(Message.WSDL_OPERATION, opName); EasyMock.expect(ep.getService()).andReturn(srv); Binding binding = control.createMock(Binding.class); EasyMock.expect(ep.getBinding()).andReturn(binding); EndpointInfo ei = control.createMock(EndpointInfo.class); EasyMock.expect(ep.getEndpointInfo()).andReturn(ei); BindingInfo bi = control.createMock(BindingInfo.class); EasyMock.expect(ei.getBinding()).andReturn(bi); BindingOperationInfo boi = control.createMock(BindingOperationInfo.class); EasyMock.expect(bi.getOperation(opName)).andReturn(boi); EasyMock.expect(bus.getExtension(ClassLoader.class)).andReturn(this.getClass().getClassLoader()); control.replay(); observer = new ColocMessageObserver(ep, bus); observer.setExchangeProperties(ex, msg); control.verify(); assertNotNull("Bus should be set", ex.getBus()); assertNotNull("Endpoint should be set", ex.getEndpoint()); assertNotNull("Binding should be set", ex.getBinding()); assertNotNull("Service should be set", ex.getService()); assertNotNull("BindingOperationInfo should be set", ex.getBindingOperationInfo()); }