manager = control.createMock(RMManager.class, new Method[] {m});
manager.setReliableEndpointsMap(new HashMap<Endpoint, RMEndpoint>());
Message message = control.createMock(Message.class);
Exchange exchange = control.createMock(Exchange.class);
EasyMock.expect(message.getExchange()).andReturn(exchange).times(3);
Endpoint endpoint = control.createMock(Endpoint.class);
EasyMock.expect(exchange.get(Endpoint.class)).andReturn(endpoint);
EndpointInfo ei = control.createMock(EndpointInfo.class);
EasyMock.expect(endpoint.getEndpointInfo()).andReturn(ei);
QName name = new QName("http://x.y.z/a", "GreeterPort");
EasyMock.expect(ei.getName()).andReturn(name);
RMEndpoint rme = control.createMock(RMEndpoint.class);
EasyMock.expect(manager.createReliableEndpoint(endpoint)).andReturn(rme);
EasyMock.expect(exchange.getDestination()).andReturn(null);
Conduit conduit = control.createMock(Conduit.class);
EasyMock.expect(exchange.getConduit(message)).andReturn(conduit);
rme.initialise(conduit, 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(endpoint);
EasyMock.expect(endpoint.getEndpointInfo()).andReturn(ei);
EasyMock.expect(ei.getName()).andReturn(name);
control.replay();
assertSame(rme, manager.getReliableEndpoint(message));
control.verify();