@Test
    public void testScanSimpleWithHeaders() throws SoapEnvelopeNotFoundException {
        String testData = "<?xml version=\"1.0\"?>\r\n" + 
                "<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\">\r\n" + 
                "  <soap:Header>\r\n" + 
                "    <ns1:MyHeader1 xmlns:ns1=\"urn:namespace1\">Foo 1</ns1:MyHeader1>\r\n" + 
                "    <ns1:MyHeader2 xmlns:ns1=\"urn:namespace1\">Foo 2</ns1:MyHeader2>\r\n" + 
                "    <ns2:MyHeader3 xmlns:ns2=\"urn:namespace2\">Foo 3</ns2:MyHeader3>\r\n" + 
                "    <ns2:MyHeader4 xmlns:ns2=\"urn:namespace2\">Foo 4</ns2:MyHeader4>\r\n" + 
                "  </soap:Header>\r\n" + 
                "  <soap:Body>\r\n" + 
                "    <m:GetStockPrice xmlns:m=\"http://www.example.org/stock/Surya\">\r\n" + 
                "      <m:StockName>IBM</m:StockName>\r\n" + 
                "    </m:GetStockPrice>\r\n" + 
                "  </soap:Body>\r\n" + 
                "</soap:Envelope>";
        IApimanBuffer buffer = new ByteBuffer(testData);
        SoapHeaderScanner scanner = new SoapHeaderScanner();
        boolean done = scanner.scan(buffer);
        Assert.assertTrue("Expected the scan to be complete but was not.", done);
        Assert.assertTrue("Expected the scan to find an XML preamble.", scanner.hasXmlPreamble());
        Assert.assertEquals("<?xml version=\"1.0\"?>", scanner.getXmlPreamble());
        String expectedEnvelopeDecl = 
                "<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\">";
        Assert.assertEquals(expectedEnvelopeDecl, scanner.getEnvelopeDeclaration());
        String expectedHeaders = 
                "<soap:Header>\r\n" + 
                "    <ns1:MyHeader1 xmlns:ns1=\"urn:namespace1\">Foo 1</ns1:MyHeader1>\r\n" + 
                "    <ns1:MyHeader2 xmlns:ns1=\"urn:namespace1\">Foo 2</ns1:MyHeader2>\r\n" + 
                "    <ns2:MyHeader3 xmlns:ns2=\"urn:namespace2\">Foo 3</ns2:MyHeader3>\r\n" + 
                "    <ns2:MyHeader4 xmlns:ns2=\"urn:namespace2\">Foo 4</ns2:MyHeader4>\r\n" + 
                "  </soap:Header>";
        Assert.assertEquals(expectedHeaders, scanner.getHeaders());
        IApimanBuffer remainingBuffer = new ByteBuffer(scanner.getRemainingBytes());
        String expectedRemaining =
                "\r\n" + 
                "  <soap:Body>\r\n" + 
                "    <m:GetStockPrice xmlns:m=\"http://www.example.org/stock/Surya\">\r\n" + 
                "      <m:StockName>IBM</m:StockName>\r\n" + 
                "    </m:GetStockPrice>\r\n" + 
                "  </soap:Body>\r\n" + 
                "</soap:Envelope>";
        Assert.assertEquals(expectedRemaining, remainingBuffer.getString(0, remainingBuffer.length()));
    }
Test method for {@link io.apiman.gateway.engine.soap.SoapHeaderScanner#scan(io.apiman.gateway.engine.io.IApimanBuffer)}.
gateway/engine/core/src/test/java/io/apiman/gateway/engine/soap/SoapHeaderScannerTest.java