Index: trunk/autoquest-httpmonitor-test/.classpath
===================================================================
--- trunk/autoquest-httpmonitor-test/.classpath	(revision 1376)
+++ trunk/autoquest-httpmonitor-test/.classpath	(revision 1376)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>
Index: trunk/autoquest-httpmonitor-test/.project
===================================================================
--- trunk/autoquest-httpmonitor-test/.project	(revision 1376)
+++ trunk/autoquest-httpmonitor-test/.project	(revision 1376)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>autoquest-httpmonitor-test</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.m2e.core.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
+	</natures>
+</projectDescription>
Index: trunk/autoquest-httpmonitor-test/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/autoquest-httpmonitor-test/.settings/org.eclipse.jdt.core.prefs	(revision 1376)
+++ trunk/autoquest-httpmonitor-test/.settings/org.eclipse.jdt.core.prefs	(revision 1376)
@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.7
Index: trunk/autoquest-httpmonitor-test/.settings/org.eclipse.m2e.core.prefs
===================================================================
--- trunk/autoquest-httpmonitor-test/.settings/org.eclipse.m2e.core.prefs	(revision 1376)
+++ trunk/autoquest-httpmonitor-test/.settings/org.eclipse.m2e.core.prefs	(revision 1376)
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
Index: trunk/autoquest-httpmonitor-test/pom.xml
===================================================================
--- trunk/autoquest-httpmonitor-test/pom.xml	(revision 1376)
+++ trunk/autoquest-httpmonitor-test/pom.xml	(revision 1376)
@@ -0,0 +1,36 @@
+<project
+    xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+>
+    <parent>
+        <groupId>de.ugoe.cs.autoquest</groupId>
+        <artifactId>autoquest-test</artifactId>
+        <version>0.0.1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>autoquest-httpmonitor-test</artifactId>
+    <licenses>
+        <license>
+            <name>The Apache Software License, Version 2.0</name>
+            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+        </license>
+    </licenses>
+    <properties>
+        <tested-artifactId>autoquest-httpmonitor</tested-artifactId>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>de.ugoe.cs.autoquest</groupId>
+            <artifactId>autoquest-plugin-http-test</artifactId>
+            <version>0.0.1-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>4.2.1</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>
Index: trunk/autoquest-httpmonitor-test/src/test/java/de/ugoe/cs/autoquest/httpmonitor/AbstractTC.java
===================================================================
--- trunk/autoquest-httpmonitor-test/src/test/java/de/ugoe/cs/autoquest/httpmonitor/AbstractTC.java	(revision 1376)
+++ trunk/autoquest-httpmonitor-test/src/test/java/de/ugoe/cs/autoquest/httpmonitor/AbstractTC.java	(revision 1376)
@@ -0,0 +1,200 @@
+//   Copyright 2012 Georg-August-Universität Göttingen, Germany
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+package de.ugoe.cs.autoquest.httpmonitor;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.logging.Level;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpRequestBase;
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
+import org.junit.After;
+import org.junit.Before;
+
+import de.ugoe.cs.util.console.TextConsole;
+
+/**
+ *
+ */
+public abstract class AbstractTC {
+    
+    /**
+     * 
+     */
+    protected static final TextConsole CONSOLE = new TextConsole(Level.FINEST);
+    
+    /**
+     * 
+     */
+    protected final static String LOG_FILE_DIR = "target/tmp/logfiles/";
+    
+    /**
+     * 
+     */
+    protected static final int PORT = 19098;
+    
+    /**
+     * the jetty web server used for receiving messages
+     */
+    private Server dummyServer;
+    
+    /**
+     * the servlet of the dummy web server responding to requests
+     */
+    private DummyServlet dummyServlet;
+
+    /**
+     * 
+     */
+    @Before
+    public void setUp() throws Exception {
+        // setup a simple HTTP server
+        dummyServer = new Server(PORT + 1);
+        
+        ServletContextHandler root =
+            new ServletContextHandler(dummyServer, "/", ServletContextHandler.SESSIONS);
+
+        dummyServlet = new DummyServlet();
+        root.addServlet(new ServletHolder(dummyServlet), "/*");
+        
+        dummyServer.start();
+        
+        setUpHook();
+    }
+
+    /**
+     *
+     */
+    protected abstract void setUpHook() throws Exception;
+
+    /**
+     *
+     */
+    @After
+    public void tearDown() throws Exception {
+        // give all started servers a second to finalize their internal work after the test
+        // execution. This prevents some unnecessary exceptions due to requests already processed
+        // by the test case but not finalized on server side.
+        Thread.sleep(1000);
+        tearDownHook();
+
+        if (dummyServer != null) {
+            try {
+                dummyServer.stop();
+            }
+            finally {
+                dummyServer = null;
+            }
+        }
+        
+        deleteFiles(new File(LOG_FILE_DIR));
+    }
+
+    /**
+     *
+     */
+    protected abstract void tearDownHook() throws Exception;
+
+    /**
+     *
+     */
+    protected String sendDummyMessage(String type, String message, String respMsg)
+        throws Exception
+    {
+        dummyServlet.setResponse(respMsg);
+        
+        System.err.println("sending message: " + message);
+        DefaultHttpClient httpclient = new DefaultHttpClient();
+        HttpRequestBase httpRequest = null;
+        
+        if ("POST".equals(type)) {
+            httpRequest = new HttpPost("http://localhost:" + PORT + "/");
+            HttpEntity entity = new StringEntity(message, ContentType.TEXT_PLAIN);
+            ((HttpPost) httpRequest).setEntity(entity);
+        }
+        else if ("GET".equals(type)) {
+            httpRequest = new HttpGet("http://localhost:" + PORT + "/");
+        }
+        
+        try {
+            HttpResponse response = httpclient.execute(httpRequest);
+            String responseStr = readStreamContentToString(response.getEntity().getContent());
+            System.err.println("received response: " + message);
+            return responseStr;
+        }
+        finally {
+            httpRequest.releaseConnection();
+        }
+    }
+    
+    /**
+     * 
+     */
+    protected String readStreamContentToString(InputStream stream) throws IOException {
+        return readToString(new BufferedReader(new InputStreamReader(stream)));
+    }
+    
+    /**
+     * 
+     */
+    protected String readToString(BufferedReader reader) throws IOException {
+        StringBuffer message = new StringBuffer();
+        
+        String line = reader.readLine();
+        while (line != null) {
+            System.err.println(line);
+            if (message.length() > 0) {
+                message.append('\n');
+            }
+            message.append(line);
+            line = reader.readLine();
+        }
+        
+        return message.toString();
+    }
+
+    /**
+     *
+     */
+    protected void deleteFiles(File file) {
+        if (file.exists()) {
+            if (file.isDirectory()) {
+                for (File child : file.listFiles()) {
+                    deleteFiles(child);
+                }
+            }
+            
+            try {
+                file.delete();
+            }
+            catch (Exception e) {
+                // ignore and delete as much as possible
+            }
+        }
+    }
+
+}
Index: trunk/autoquest-httpmonitor-test/src/test/java/de/ugoe/cs/autoquest/httpmonitor/DummyServlet.java
===================================================================
--- trunk/autoquest-httpmonitor-test/src/test/java/de/ugoe/cs/autoquest/httpmonitor/DummyServlet.java	(revision 1376)
+++ trunk/autoquest-httpmonitor-test/src/test/java/de/ugoe/cs/autoquest/httpmonitor/DummyServlet.java	(revision 1376)
@@ -0,0 +1,74 @@
+//   Copyright 2012 Georg-August-Universität Göttingen, Germany
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+package de.ugoe.cs.autoquest.httpmonitor;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @author Patrick Harms
+ */
+class DummyServlet extends HttpServlet {
+
+    /**  */
+    private static final long serialVersionUID = 1L;
+    
+    /** */
+    private String responseMessage;
+
+    /* (non-Javadoc)
+     * @see org.mortbay.jetty.servlet.DefaultServlet#doGet(HttpServletRequest, HttpServletResponse)
+     */
+    @Override
+    protected void doGet(HttpServletRequest request, HttpServletResponse response)
+        throws ServletException, IOException
+    {
+        System.err.println("responding on get with:   " + responseMessage);
+        response.getOutputStream().write(responseMessage.getBytes());
+    }
+
+    /* (non-Javadoc)
+     * @see org.mortbay.jetty.servlet.DefaultServlet#doPost(HttpServletRequest, HttpServletResponse)
+     */
+    @Override
+    protected void doPost(HttpServletRequest request, HttpServletResponse response)
+        throws ServletException, IOException
+    {
+        System.err.println("responding on post with:  " + responseMessage);
+        response.getOutputStream().write(responseMessage.getBytes());
+    }
+
+    /* (non-Javadoc)
+     * @see org.mortbay.jetty.servlet.DefaultServlet#doTrace(HttpServletRequest, HttpServletResponse)
+     */
+    @Override
+    protected void doTrace(HttpServletRequest req, HttpServletResponse response)
+        throws ServletException, IOException
+    {
+        System.err.println("responding on trace with: " + responseMessage);
+        response.getOutputStream().write(responseMessage.getBytes());
+    }
+
+    /**
+     * 
+     */
+    void setResponse(String responseMessage) {
+        this.responseMessage = responseMessage;
+    }
+}
Index: trunk/autoquest-httpmonitor-test/src/test/java/de/ugoe/cs/autoquest/httpmonitor/HttpMonitorTest.java
===================================================================
--- trunk/autoquest-httpmonitor-test/src/test/java/de/ugoe/cs/autoquest/httpmonitor/HttpMonitorTest.java	(revision 1376)
+++ trunk/autoquest-httpmonitor-test/src/test/java/de/ugoe/cs/autoquest/httpmonitor/HttpMonitorTest.java	(revision 1376)
@@ -0,0 +1,340 @@
+//   Copyright 2012 Georg-August-Universität Göttingen, Germany
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+package de.ugoe.cs.autoquest.httpmonitor;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.StringWriter;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.junit.Test;
+
+import de.ugoe.cs.autoquest.eventcore.Event;
+import de.ugoe.cs.autoquest.http.HTTPTestUtils;
+import de.ugoe.cs.autoquest.httpmonitor.exchange.HttpExchange;
+import de.ugoe.cs.autoquest.httpmonitor.exchange.ObjectFactory;
+import de.ugoe.cs.autoquest.httpmonitor.exchange.Session;
+import de.ugoe.cs.autoquest.httpmonitor.proxy.HttpMonitoringProxy;
+import de.ugoe.cs.autoquest.plugin.http.HTTPLogParser;
+import de.ugoe.cs.autoquest.plugin.http.HTTPUtils;
+import de.ugoe.cs.autoquest.plugin.http.eventcore.HTTPEventType;
+import de.ugoe.cs.autoquest.plugin.http.eventcore.HTTPTarget;
+
+/**
+ * @author Patrick Harms
+ */
+public class HttpMonitorTest extends AbstractTC {
+    
+    /**
+     * 
+     */
+    private HttpMonitoringProxy proxy;
+
+    /**
+     * 
+     */
+    private HttpMonitor monitor;
+
+    /* (non-Javadoc)
+     * @see de.ugoe.cs.autoquest.httpmonitor.AbstractTC#setUpHook()
+     */
+    @Override
+    protected void setUpHook() throws Exception {
+        // nothing to do
+    }
+
+    /**
+     *
+     */
+    public void tearDownHook() throws Exception {
+        if (proxy != null) {
+            try {
+                proxy.stop();
+            }
+            finally {
+                proxy = null;
+            }
+        }
+        if (monitor != null) {
+            try {
+                monitor.stop();
+            }
+            finally {
+                monitor = null;
+            }
+        }
+    }
+    
+    @Test
+    public void test_SimulatedSession_MonitorOnly() throws Exception {
+        monitor = new HttpMonitor(new String[] { LOG_FILE_DIR, PORT +"" });
+
+        monitor.init();
+        monitor.start();
+        
+        Session simulatedSession = HTTPTestUtils.createRandomSession(50);
+        sendExchanges(simulatedSession.getHttpExchange());
+        
+        monitor.stop();
+        monitor = null;
+
+        File logFile = new File(LOG_FILE_DIR + File.separator + "httpmonitor_000.log");
+        
+        assertTrue(logFile.exists());
+        
+        HTTPLogParser parser = new HTTPLogParser();
+
+        parser.parseFile(logFile);
+
+        // check the sequences
+        Collection<List<Event>> sequences = parser.getSequences();
+
+        assertNotNull(sequences);
+
+        Iterator<List<Event>> iterator = sequences.iterator();
+        assertTrue(iterator.hasNext());
+
+        List<Event> sequence = iterator.next();
+        assertFalse(iterator.hasNext());
+
+        assertNotNull(sequence);
+        assertEquals(simulatedSession.getHttpExchange().size(), sequence.size());
+
+        System.out.println("{");
+        System.out.println("  {");
+        for (int j = 0; j < sequence.size(); j++) {
+            System.out.print("    ");
+            System.out.print(sequence.get(j));
+            System.out.println(",");
+
+            assertNotNull(sequence.get(j));
+            assertNotNull(sequence.get(j).getType());
+            assertTrue(sequence.get(j).getType() instanceof HTTPEventType);
+
+            assertNotNull(sequence.get(j).getTarget());
+            assertTrue(sequence.get(j).getTarget() instanceof HTTPTarget);
+
+            HTTPTestUtils.assertExchangeEquals
+                (simulatedSession.getHttpExchange().get(j),
+                 ((HTTPEventType) sequence.get(j).getType()).getExchange());
+
+            assertEquals(HTTPUtils.toString(simulatedSession.getHttpExchange().get(j).getReceiver()),
+                         ((HTTPTarget) sequence.get(j).getTarget()).getStringIdentifier());
+        }
+        System.out.println("  }");
+        System.out.println("}");
+        System.out.println("\n\n");
+    }
+
+    @Test
+    public void test_SimpleText_ProxyAndMonitor() throws Exception {
+        monitor = new HttpMonitor(new String[] { LOG_FILE_DIR, (PORT + 2) + "" });
+
+        monitor.init();
+        monitor.start();
+
+        proxy = new HttpMonitoringProxy
+            (new String[] { LOG_FILE_DIR, PORT +"",
+                            "localhost:" + (PORT + 1), "localhost:" + (PORT + 2) });
+
+        proxy.init();
+        proxy.start();
+        
+        String message = "dummy message";
+        String expectedResponse = "response content";
+        String response = sendDummyMessage("POST", message, expectedResponse);
+        
+        assertEquals(expectedResponse, response);
+        
+        // the monitor needs some time to receive the exchange --> give it
+        Thread.sleep(1000);
+        
+        monitor.stop();
+        monitor = null;
+
+        File logFile = new File(LOG_FILE_DIR + File.separator + "httpmonitor_000.log");
+        
+        assertTrue(logFile.exists());
+        
+        HTTPLogParser parser = new HTTPLogParser();
+
+        parser.parseFile(logFile);
+
+        // check the sequences
+        Collection<List<Event>> sequences = parser.getSequences();
+
+        assertNotNull(sequences);
+
+        Iterator<List<Event>> iterator = sequences.iterator();
+        assertTrue(iterator.hasNext());
+
+        List<Event> sequence = iterator.next();
+        assertFalse(iterator.hasNext());
+
+        assertNotNull(sequence);
+        assertEquals(1, sequence.size());
+
+        assertNotNull(sequence.get(0));
+        assertNotNull(sequence.get(0).getType());
+        assertTrue(sequence.get(0).getType() instanceof HTTPEventType);
+
+        assertNotNull(sequence.get(0).getTarget());
+        assertTrue(sequence.get(0).getTarget() instanceof HTTPTarget);
+
+        HttpExchange exchange = ((HTTPEventType) sequence.get(0).getType()).getExchange();
+        
+        assertEquals(message, exchange.getRequest().getContent().getData());
+        assertEquals(response, exchange.getResponse().getContent().getData());
+    }
+
+    @Test
+    public void test_XMLMessage_ProxyAndMonitor() throws Exception {
+        monitor = new HttpMonitor(new String[] { LOG_FILE_DIR, (PORT + 2) + "" });
+
+        monitor.init();
+        monitor.start();
+
+        proxy = new HttpMonitoringProxy
+            (new String[] { LOG_FILE_DIR, PORT +"",
+                            "localhost:" + (PORT + 1), "localhost:" + (PORT + 2) });
+
+        proxy.init();
+        proxy.start();
+        
+        String message =
+            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+            "<xsd:schema targetNamespace=\"http://autoquest.informatik.uni-goettingen.de\">" +
+            "  <xsd:element name=\"httpEvent\" type=\"tns:HttpEvent\" />" +
+            "</xsd:schema>";
+    
+        String expectedResponse =
+            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+            "<httpEvent status=\"success\" xmlns=\"http://autoquest.informatik.uni-goettingen.de\">" +
+            "  <sender><ip>127.0.0.1</ip><host>127.0.0.1</host><port>42688</port></sender>" +
+            "  <receiver><ip>127.0.0.1</ip><host>127.0.0.1</host><port>19098</port></receiver>" +
+            "  <request method=\"POST\" protocol=\"HTTP/1.1\" url=\"http://localhost:19098/\">" +
+            "    <headers>" +
+            "      <header key=\"User-Agent\" value=\"Apache-HttpClient/4.2.1 (java 1.5)\"/>" +
+            "      <header key=\"Connection\" value=\"keep-alive\"/>" +
+            "      <header key=\"Host\" value=\"localhost:19098\"/>" +
+            "      <header key=\"Content-Type\" value=\"text/plain; charset=ISO-8859-1\"/>" +
+            "      <header key=\"Content-Length\" value=\"13\"/>" +
+            "    </headers>" +
+            "    <content encoding=\"ISO-8859-1\" type=\"text/plain; charset=ISO-8859-1\"" +
+            "             length=\"13\">" +
+            "      <data>dummy message</data>" +
+            "    </content>" +
+            "  </request>" +
+            "  <response status=\"200\">" +
+            "    <headers>" +
+            "      <header key=\"Server\" value=\"Jetty(9.1.0.M0)\"/>" +
+            "      <header key=\"Content-Length\" value=\"16\"/>" +
+            "    </headers>" +
+            "    <content encoding=\"ISO-8859-1\" length=\"16\">" +
+            "      <data>response content</data>" +
+            "    </content>" +
+            "  </response>" +
+            "</httpEvent>";
+
+        String response = sendDummyMessage("POST", message, expectedResponse);
+        
+        assertEquals(expectedResponse, response);
+        
+        // the monitor needs some time to receive the exchange --> give it
+        Thread.sleep(1000);
+        
+        monitor.stop();
+        monitor = null;
+
+        File logFile = new File(LOG_FILE_DIR + File.separator + "httpmonitor_000.log");
+        
+        assertTrue(logFile.exists());
+        
+        HTTPLogParser parser = new HTTPLogParser();
+
+        parser.parseFile(logFile);
+
+        // check the sequences
+        Collection<List<Event>> sequences = parser.getSequences();
+
+        assertNotNull(sequences);
+
+        Iterator<List<Event>> iterator = sequences.iterator();
+        assertTrue(iterator.hasNext());
+
+        List<Event> sequence = iterator.next();
+        assertFalse(iterator.hasNext());
+
+        assertNotNull(sequence);
+        assertEquals(1, sequence.size());
+
+        assertNotNull(sequence.get(0));
+        assertNotNull(sequence.get(0).getType());
+        assertTrue(sequence.get(0).getType() instanceof HTTPEventType);
+
+        assertNotNull(sequence.get(0).getTarget());
+        assertTrue(sequence.get(0).getTarget() instanceof HTTPTarget);
+
+        HttpExchange exchange = ((HTTPEventType) sequence.get(0).getType()).getExchange();
+        
+        assertEquals(message, exchange.getRequest().getContent().getData());
+        assertEquals(response, exchange.getResponse().getContent().getData());
+    }
+    
+    /**
+     *
+     */
+    private void sendExchanges(List<HttpExchange> exchanges) throws Exception {
+        DefaultHttpClient httpclient = new DefaultHttpClient();
+        
+        for (HttpExchange exchange : exchanges) {
+            HttpPost httpRequest = new HttpPost("http://localhost:" + PORT + "/");
+            
+            JAXBContext jaxbContext =
+                    JAXBContext.newInstance(HttpExchange.class.getPackage().getName());
+            Marshaller marshaller = jaxbContext.createMarshaller();
+
+            StringWriter out = new StringWriter();
+            marshaller.marshal(new ObjectFactory().createHttpExchange(exchange), out);
+
+            HttpEntity entity = new StringEntity
+                (out.toString(), ContentType.create("text/plain", "UTF-8"));
+            ((HttpPost) httpRequest).setEntity(entity);
+        
+            try {
+                httpclient.execute(httpRequest);
+            }
+            finally {
+                httpRequest.releaseConnection();
+                out.close();
+            }
+        }
+    }
+
+}
Index: trunk/autoquest-httpmonitor-test/src/test/java/de/ugoe/cs/autoquest/httpmonitor/HttpMonitoringProxyTest.java
===================================================================
--- trunk/autoquest-httpmonitor-test/src/test/java/de/ugoe/cs/autoquest/httpmonitor/HttpMonitoringProxyTest.java	(revision 1376)
+++ trunk/autoquest-httpmonitor-test/src/test/java/de/ugoe/cs/autoquest/httpmonitor/HttpMonitoringProxyTest.java	(revision 1376)
@@ -0,0 +1,373 @@
+//   Copyright 2012 Georg-August-Universität Göttingen, Germany
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+package de.ugoe.cs.autoquest.httpmonitor;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.Unmarshaller;
+
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
+import org.junit.Test;
+
+import de.ugoe.cs.autoquest.eventcore.Event;
+import de.ugoe.cs.autoquest.httpmonitor.exchange.HttpExchange;
+import de.ugoe.cs.autoquest.httpmonitor.exchange.Method;
+import de.ugoe.cs.autoquest.httpmonitor.proxy.HttpMonitoringProxy;
+import de.ugoe.cs.autoquest.plugin.http.HTTPLogParser;
+import de.ugoe.cs.autoquest.plugin.http.eventcore.HTTPEventType;
+import de.ugoe.cs.autoquest.plugin.http.eventcore.HTTPTarget;
+
+/**
+ * @author Patrick Harms
+ */
+public class HttpMonitoringProxyTest extends AbstractTC {
+
+    /**
+     * 
+     */
+    private HttpMonitoringProxy proxy;
+
+    /**
+     * the jetty web server used for receiving messages copied by the proxy
+     */
+    private Server dummyMonitor;
+    
+    /**
+     * the messages received by the dummy monitor
+     */
+    private List<String> messages;
+
+    /**
+     * 
+     */
+    protected void setUpHook() throws Exception {
+        // setup a simple HTTP server
+        messages = new LinkedList<String>();
+        
+        dummyMonitor = new Server(PORT + 2);
+        ServletContextHandler root =
+            new ServletContextHandler(dummyMonitor, "/", ServletContextHandler.SESSIONS);
+
+        root.addServlet(new ServletHolder(new DummyMonitorServlet()), "/*");
+        
+        dummyMonitor.start();
+    }
+    
+    /**
+     *
+     */
+    protected void tearDownHook() throws Exception {
+        if (proxy != null) {
+            try {
+                proxy.stop();
+            }
+            finally {
+                proxy = null;
+            }
+        }
+        if (dummyMonitor != null) {
+            try {
+                dummyMonitor.stop();
+            }
+            finally {
+                dummyMonitor = null;
+            }
+        }
+        messages = null;
+    }
+    
+    @Test(expected=java.lang.IllegalArgumentException.class)
+    public void test_InvalidInitialization_01() throws Exception {
+        proxy = new HttpMonitoringProxy(new String[] {  });
+    }
+    
+    @Test
+    public void test_SimpleText_Local() throws Exception {
+        proxy = new HttpMonitoringProxy
+            (new String[] { LOG_FILE_DIR, PORT +"", "localhost:" + (PORT + 1), "local" });
+
+        proxy.init();
+        proxy.start();
+        
+        String message = "dummy message";
+        String expectedResponse = "response content";
+        String response = sendDummyMessage("POST", message, expectedResponse);
+        
+        assertEquals(expectedResponse, response);
+        
+        proxy.stop();
+        proxy = null;
+
+        File logFile = new File(LOG_FILE_DIR + File.separator + "httpmonitor_000.log");
+        
+        assertTrue(logFile.exists());
+        
+        HTTPLogParser parser = new HTTPLogParser();
+
+        parser.parseFile(logFile);
+
+        // check the sequences
+        Collection<List<Event>> sequences = parser.getSequences();
+
+        assertNotNull(sequences);
+
+        Iterator<List<Event>> iterator = sequences.iterator();
+        assertTrue(iterator.hasNext());
+
+        List<Event> sequence = iterator.next();
+        assertFalse(iterator.hasNext());
+
+        assertNotNull(sequence);
+        assertEquals(1, sequence.size());
+
+        assertEvent(sequence.get(0), "POST", message, expectedResponse);
+    }
+
+    @Test
+    public void test_SimpleText_Remote() throws Exception {
+        proxy = new HttpMonitoringProxy
+            (new String[] { LOG_FILE_DIR, PORT +"",
+                            "localhost:" + (PORT + 1), "localhost:" + (PORT + 2) });
+
+        proxy.init();
+        proxy.start();
+        
+        String message = "dummy message";
+        String expectedResponse = "response content";
+        String response = sendDummyMessage("POST", message, expectedResponse);
+        
+        assertEquals(expectedResponse, response);
+        
+        // give the proxy some time to send the copy of the message
+        while(messages.size() < 1) {
+            Thread.sleep(1000);
+        }
+        
+        assertEquals(1, messages.size());
+        
+        JAXBContext jaxbContext = JAXBContext.newInstance(HttpExchange.class.getPackage().getName());
+        Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+        
+        @SuppressWarnings("unchecked")
+        JAXBElement<HttpExchange> jaxObject =
+            (JAXBElement<HttpExchange>) unmarshaller.unmarshal(new StringReader(messages.get(0)));
+        
+        HttpExchange exchange = jaxObject.getValue();
+        
+        assertEquals(message, exchange.getRequest().getContent().getData());
+        assertEquals(response, exchange.getResponse().getContent().getData());
+    }
+    
+    @Test
+    public void test_XMLMessage_Local() throws Exception {
+        proxy = new HttpMonitoringProxy
+            (new String[] { LOG_FILE_DIR, PORT +"", "localhost:" + (PORT + 1), "local" });
+
+        proxy.init();
+        proxy.start();
+            
+        String message =
+            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+            "<xsd:schema targetNamespace=\"http://autoquest.informatik.uni-goettingen.de\">" +
+            "  <xsd:element name=\"httpEvent\" type=\"tns:HttpEvent\" />" +
+            "</xsd:schema>";
+        
+        String expectedResponse =
+            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+            "<httpEvent status=\"success\" xmlns=\"http://autoquest.informatik.uni-goettingen.de\">" +
+            "  <sender><ip>127.0.0.1</ip><host>127.0.0.1</host><port>42688</port></sender>" +
+            "  <receiver><ip>127.0.0.1</ip><host>127.0.0.1</host><port>19098</port></receiver>" +
+            "  <request method=\"POST\" protocol=\"HTTP/1.1\" url=\"http://localhost:19098/\">" +
+            "    <headers>" +
+            "      <header key=\"User-Agent\" value=\"Apache-HttpClient/4.2.1 (java 1.5)\"/>" +
+            "      <header key=\"Connection\" value=\"keep-alive\"/>" +
+            "      <header key=\"Host\" value=\"localhost:19098\"/>" +
+            "      <header key=\"Content-Type\" value=\"text/plain; charset=ISO-8859-1\"/>" +
+            "      <header key=\"Content-Length\" value=\"13\"/>" +
+            "    </headers>" +
+            "    <content encoding=\"ISO-8859-1\" type=\"text/plain; charset=ISO-8859-1\"" +
+            "             length=\"13\">" +
+            "      <data>dummy message</data>" +
+            "    </content>" +
+            "  </request>" +
+            "  <response status=\"200\">" +
+            "    <headers>" +
+            "      <header key=\"Server\" value=\"Jetty(9.1.0.M0)\"/>" +
+            "      <header key=\"Content-Length\" value=\"16\"/>" +
+            "    </headers>" +
+            "    <content encoding=\"ISO-8859-1\" length=\"16\">" +
+            "      <data>response content</data>" +
+            "    </content>" +
+            "  </response>" +
+            "</httpEvent>";
+
+        String response = sendDummyMessage("POST", message, expectedResponse);
+        
+        assertEquals(expectedResponse, response);
+        
+        proxy.stop();
+        proxy = null;
+
+        File logFile = new File(LOG_FILE_DIR + File.separator + "httpmonitor_000.log");
+        
+        assertTrue(logFile.exists());
+        
+        HTTPLogParser parser = new HTTPLogParser();
+
+        parser.parseFile(logFile);
+
+        // check the sequences
+        Collection<List<Event>> sequences = parser.getSequences();
+
+        assertNotNull(sequences);
+
+        Iterator<List<Event>> iterator = sequences.iterator();
+        assertTrue(iterator.hasNext());
+
+        List<Event> sequence = iterator.next();
+        assertFalse(iterator.hasNext());
+
+        assertNotNull(sequence);
+        assertEquals(1, sequence.size());
+
+        assertEvent(sequence.get(0), "POST", message, expectedResponse);
+    }
+    
+    @Test
+    public void test_XMLMessage_Remote() throws Exception {
+        proxy = new HttpMonitoringProxy
+            (new String[] { LOG_FILE_DIR, PORT +"",
+                            "localhost:" + (PORT + 1), "localhost:" + (PORT + 2) });
+
+        proxy.init();
+        proxy.start();
+            
+        String message =
+            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+            "<xsd:schema targetNamespace=\"http://autoquest.informatik.uni-goettingen.de\">" +
+            "  <xsd:element name=\"httpEvent\" type=\"tns:HttpEvent\" />" +
+            "</xsd:schema>";
+        
+        String expectedResponse =
+            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+            "<httpEvent status=\"success\" xmlns=\"http://autoquest.informatik.uni-goettingen.de\">" +
+            "  <sender><ip>127.0.0.1</ip><host>127.0.0.1</host><port>42688</port></sender>" +
+            "  <receiver><ip>127.0.0.1</ip><host>127.0.0.1</host><port>19098</port></receiver>" +
+            "  <request method=\"POST\" protocol=\"HTTP/1.1\" url=\"http://localhost:19098/\">" +
+            "    <headers>" +
+            "      <header key=\"User-Agent\" value=\"Apache-HttpClient/4.2.1 (java 1.5)\"/>" +
+            "      <header key=\"Connection\" value=\"keep-alive\"/>" +
+            "      <header key=\"Host\" value=\"localhost:19098\"/>" +
+            "      <header key=\"Content-Type\" value=\"text/plain; charset=ISO-8859-1\"/>" +
+            "      <header key=\"Content-Length\" value=\"13\"/>" +
+            "    </headers>" +
+            "    <content encoding=\"ISO-8859-1\" type=\"text/plain; charset=ISO-8859-1\"" +
+            "             length=\"13\">" +
+            "      <data>dummy message</data>" +
+            "    </content>" +
+            "  </request>" +
+            "  <response status=\"200\">" +
+            "    <headers>" +
+            "      <header key=\"Server\" value=\"Jetty(9.1.0.M0)\"/>" +
+            "      <header key=\"Content-Length\" value=\"16\"/>" +
+            "    </headers>" +
+            "    <content encoding=\"ISO-8859-1\" length=\"16\">" +
+            "      <data>response content</data>" +
+            "    </content>" +
+            "  </response>" +
+            "</httpEvent>";
+
+        String response = sendDummyMessage("POST", message, expectedResponse);
+        
+        assertEquals(expectedResponse, response);
+        
+        // give the proxy some time to send the copy of the message
+        while(messages.size() < 1) {
+            Thread.sleep(1000);
+        }
+        
+        assertEquals(1, messages.size());
+        
+        JAXBContext jaxbContext = JAXBContext.newInstance(HttpExchange.class.getPackage().getName());
+        Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+        
+        @SuppressWarnings("unchecked")
+        JAXBElement<HttpExchange> jaxObject =
+            (JAXBElement<HttpExchange>) unmarshaller.unmarshal(new StringReader(messages.get(0)));
+        
+        HttpExchange exchange = jaxObject.getValue();
+        
+        assertEquals(message, exchange.getRequest().getContent().getData());
+        assertEquals(response, exchange.getResponse().getContent().getData());
+    }
+    
+    /**
+     *
+     */
+    private void assertEvent(Event event, String method, String message, String response) {
+        assertNotNull(event);
+        assertNotNull(event.getType());
+        assertNotNull(event.getTarget());
+        
+        assertTrue(event.getType() instanceof HTTPEventType);
+        assertTrue(event.getTarget() instanceof HTTPTarget);
+        
+        HttpExchange exchange = ((HTTPEventType) event.getType()).getExchange();
+        
+        assertEquals(Method.fromValue(method), exchange.getRequest().getMethod());
+        assertEquals(message, exchange.getRequest().getContent().getData());
+        assertEquals(response, exchange.getResponse().getContent().getData());
+    }
+
+    /**
+     * @author Patrick Harms
+     */
+    private class DummyMonitorServlet extends HttpServlet {
+
+        /**  */
+        private static final long serialVersionUID = 1L;
+        
+        /* (non-Javadoc)
+         * @see javax.servlet.http.HttpServlet#service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
+         */
+        @Override
+        protected void doPost(HttpServletRequest req, HttpServletResponse resp)
+            throws ServletException, IOException
+        {
+            messages.add(readToString(req.getReader()));
+            
+            resp.setStatus(HttpServletResponse.SC_OK);
+        }
+        
+        
+    }
+
+}
