@Test
public void testDtoToGeotools() throws JiBXException, IOException, SAXException, ParserConfigurationException,
InterruptedException {
// read dto
IBindingFactory bfact = BindingDirectory.getFactory(StyledLayerDescriptorInfo.class);
IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
StyledLayerDescriptorInfo sld = (StyledLayerDescriptorInfo) uctx.unmarshalDocument(getClass()
.getResourceAsStream("samples/example-sld.xml"), null);
// pipe to geotools parser
StyleFactory factory = CommonFactoryFinder.getStyleFactory(null);
PipedOutputStream pos = new PipedOutputStream();
PipedInputStream pii = new PipedInputStream(pos);
final SLDParser parser = new SLDParser(factory, pii);
IMarshallingContext mctx = bfact.createMarshallingContext();
mctx.setOutput(new PrintWriter(pos));
CountDownLatch countDown = new CountDownLatch(2);
ArrayList<Style> styles = new ArrayList<Style>();
new Thread(new Parser(countDown, parser, styles)).start();