Document document = domFactory.createDocument();
protocol.writeProtocolString(document);
StringWriter writer = new StringWriter();
DocumentWriter documentWriter = new XMLDocumentWriter(writer);
XMLDeclaration declaration = document.getDeclaration();
if (declaration != null) {
documentWriter.outputXMLDeclaration(declaration);
}
DocType docType = document.getDocType();
if (docType != null) {
documentWriter.outputDocType(docType);
}
assertEquals("Protocol string should match",
expectedProtocolString,
writer.getBuffer().toString());