Message message = control.createMock(Message.class);
Exchange exchange = control.createMock(Exchange.class);
EasyMock.expect(message.getExchange()).andReturn(exchange).anyTimes();
WrappedEndpoint wre = control.createMock(WrappedEndpoint.class);
EasyMock.expect(exchange.get(Endpoint.class)).andReturn(wre);
EndpointInfo ei = control.createMock(EndpointInfo.class);
EasyMock.expect(wre.getEndpointInfo()).andReturn(ei);
QName name = RMConstants.getPortName();
EasyMock.expect(ei.getName()).andReturn(name);
Endpoint e = control.createMock(Endpoint.class);
EasyMock.expect(wre.getWrappedEndpoint()).andReturn(e);
RMEndpoint rme = control.createMock(RMEndpoint.class);
EasyMock.expect(manager.createReliableEndpoint(e)).andReturn(rme);
org.apache.cxf.transport.Destination destination = control
.createMock(org.apache.cxf.transport.Destination.class);
EasyMock.expect(exchange.getDestination()).andReturn(destination);
AddressingPropertiesImpl maps = control.createMock(AddressingPropertiesImpl.class);
EasyMock.expect(message.get(Message.REQUESTOR_ROLE)).andReturn(null);
EasyMock.expect(message.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND)).andReturn(maps);
EndpointReferenceType replyTo = RMUtils.createAnonymousReference();
EasyMock.expect(maps.getReplyTo()).andReturn(replyTo);
EasyMock.expect(exchange.getConduit(message)).andReturn(null);
rme.initialise(null, replyTo, null);
EasyMock.expectLastCall();
control.replay();
assertSame(rme, manager.getReliableEndpoint(message));
control.verify();
control.reset();
EasyMock.expect(message.getExchange()).andReturn(exchange);
EasyMock.expect(exchange.get(Endpoint.class)).andReturn(wre);
EasyMock.expect(wre.getEndpointInfo()).andReturn(ei);
EasyMock.expect(ei.getName()).andReturn(name);
EasyMock.expect(wre.getWrappedEndpoint()).andReturn(e);
control.replay();
assertSame(rme, manager.getReliableEndpoint(message));
control.verify();