@Test
public void testWithManualMultiplexEprCreation() throws Exception {
NumberFactoryService service = new NumberFactoryService();
NumberFactory nfact = service.getNumberFactoryPort();
W3CEndpointReference w3cEpr = nfact.create("2");
assertNotNull("reference", w3cEpr);
// use the epr info only
// no wsdl so default generated soap/http binding will be used
// address url must come from the calling context
EndpointReferenceType epr = VersionTransformer.convertToInternal(w3cEpr);
QName serviceName = EndpointReferenceUtils.getServiceName(epr, bus);
Service numService = Service.create(serviceName);
String portString = EndpointReferenceUtils.getPortName(epr);
QName portName = new QName(serviceName.getNamespaceURI(), portString);
numService.addPort(portName, SoapBindingFactory.SOAP_11_BINDING, "http://foo");
Number num = (Number)numService.getPort(portName, Number.class);
setupContextWithEprAddress(epr, num);
IsEvenResponse numResp = num.isEven();
assertTrue("2 is even", Boolean.TRUE.equals(numResp.isEven()));
// try again with the address from another epr
w3cEpr = nfact.create("3");
epr = VersionTransformer.convertToInternal(w3cEpr);
setupContextWithEprAddress(epr, num);
numResp = num.isEven();
assertTrue("3 is not even", Boolean.FALSE.equals(numResp.isEven()));
// try again with the address from another epr
w3cEpr = nfact.create("6");
epr = VersionTransformer.convertToInternal(w3cEpr);
setupContextWithEprAddress(epr, num);
numResp = num.isEven();
assertTrue("6 is even", Boolean.TRUE.equals(numResp.isEven()));
}