Search in sources :

Example 1 with IRemoteCommandVisitor

use of org.jacoco.core.runtime.IRemoteCommandVisitor in project jacoco by jacoco.

the class DumpTest method serveRequest.

private void serveRequest(Socket socket) throws IOException {
    final RemoteControlWriter writer = new RemoteControlWriter(socket.getOutputStream());
    final RemoteControlReader reader = new RemoteControlReader(socket.getInputStream());
    reader.setRemoteCommandVisitor(new IRemoteCommandVisitor() {

        public void visitDumpCommand(boolean dump, boolean reset) throws IOException {
            writer.sendCmdOk();
        }
    });
    while (reader.read()) {
    }
}
Also used : RemoteControlWriter(org.jacoco.core.runtime.RemoteControlWriter) IRemoteCommandVisitor(org.jacoco.core.runtime.IRemoteCommandVisitor) IOException(java.io.IOException) RemoteControlReader(org.jacoco.core.runtime.RemoteControlReader)

Example 2 with IRemoteCommandVisitor

use of org.jacoco.core.runtime.IRemoteCommandVisitor in project jacoco by jacoco.

the class ExecDumpClientTest method handleConnection.

private void handleConnection(Socket socket) throws IOException {
    final RemoteControlWriter writer = new RemoteControlWriter(socket.getOutputStream());
    final RemoteControlReader reader = new RemoteControlReader(socket.getInputStream());
    reader.setRemoteCommandVisitor(new IRemoteCommandVisitor() {

        public void visitDumpCommand(boolean dump, boolean reset) throws IOException {
            dumpRequested = dump;
            resetRequested = reset;
            if (dump) {
                writer.visitSessionInfo(new SessionInfo("TestId", 100, 200));
            }
            writer.sendCmdOk();
        }
    });
    reader.read();
}
Also used : RemoteControlWriter(org.jacoco.core.runtime.RemoteControlWriter) IRemoteCommandVisitor(org.jacoco.core.runtime.IRemoteCommandVisitor) SessionInfo(org.jacoco.core.data.SessionInfo) IOException(java.io.IOException) RemoteControlReader(org.jacoco.core.runtime.RemoteControlReader)

Aggregations

IOException (java.io.IOException)2 IRemoteCommandVisitor (org.jacoco.core.runtime.IRemoteCommandVisitor)2 RemoteControlReader (org.jacoco.core.runtime.RemoteControlReader)2 RemoteControlWriter (org.jacoco.core.runtime.RemoteControlWriter)2 SessionInfo (org.jacoco.core.data.SessionInfo)1