messageSender.setMaxConnectionsPerHost(maxConnectionsPerHost);
}
@Test
public void testContextClose() throws Exception {
MessageFactory messageFactory = MessageFactory.newInstance();
int port = FreePortScanner.getFreePort();
Server jettyServer = new Server(port);
Context jettyContext = new Context(jettyServer, "/");
jettyContext.addServlet(new ServletHolder(new EchoServlet()), "/");
jettyServer.start();
WebServiceConnection connection = null;
try {
StaticApplicationContext appContext = new StaticApplicationContext();
appContext.registerSingleton("messageSender", CommonsHttpMessageSender.class);
appContext.refresh();
CommonsHttpMessageSender messageSender = appContext
.getBean("messageSender", CommonsHttpMessageSender.class);
connection = messageSender.createConnection(new URI("http://localhost:" + port));
appContext.close();
connection.send(new SaajSoapMessage(messageFactory.createMessage()));
connection.receive(new SaajSoapMessageFactory(messageFactory));
}
finally {
if (connection != null) {
try {