@Test(expected = HttpServerErrorException.class)
	public void testErrorResponse() throws URISyntaxException {
		DirectChannel channel = new DirectChannel();
		channel.subscribe(new MessageHandler() {

			@Override
			public void handleMessage(Message<?> message) throws MessagingException {
				throw new RuntimeException();
			}
		});
		int port = SocketUtils.findAvailableServerSocket();
		NettyHttpInboundChannelAdapter adapter = new NettyHttpInboundChannelAdapter(port);
		adapter.setOutputChannel(channel);
		adapter.start();
		RestTemplate template = new RestTemplate();
		URI uri1 = new URI("http://localhost:" + port + "/test1");
		template.postForEntity(uri1, "foo", Object.class);

		adapter.stop();
	}
@author Mark Fisher
@author David Turanski
@author Jennifer Hickey
@author Gary Russell
@author Peter Rietzler
extensions/spring-xd-extension-http/src/test/java/org/springframework/integration/x/http/NettyHttpInboundChannelAdapterTests.java