Package org.jacoco.agent.rt.internal.output

Examples of org.jacoco.agent.rt.internal.output.TcpConnection


    final OutputStream remoteOut = mockConnection.getSocketB()
        .getOutputStream();
    remoteOut.write(0x01);
    remoteOut.write(0xC0);
    remoteOut.write(0xCA);
    final TcpConnection connection = new TcpConnection(
        mockConnection.getSocketA(), data);
    connection.init();
    connection.run();
  }
View Full Code Here


  @Test(expected = IOException.class)
  public void testInvalidContent() throws Exception {
    final OutputStream remoteOut = mockConnection.getSocketB()
        .getOutputStream();
    new ExecutionDataWriter(remoteOut);
    final TcpConnection con = new TcpConnection(
        mockConnection.getSocketA(), data);
    con.init();
    remoteOut.write(123);
    con.run();
  }
View Full Code Here

  public void testRemoteClose() throws Exception {
    final OutputStream remoteOut = mockConnection.getSocketB()
        .getOutputStream();
    new ExecutionDataWriter(remoteOut);

    final TcpConnection con = new TcpConnection(
        mockConnection.getSocketA(), data);
    con.init();

    final Future<Void> f = executor.submit(new Callable<Void>() {
      public Void call() throws Exception {
        con.run();
        return null;
      }
    });

    assertBlocks(f);
View Full Code Here

  /**
   * Remote endpoint is closed before even a valid header was send.
   */
  public void testRemoteCloseWithoutHeader() throws Throwable {
    final TcpConnection con = new TcpConnection(
        mockConnection.getSocketA(), data);

    final Future<Void> f = executor.submit(new Callable<Void>() {
      public Void call() throws Exception {
        con.init();
        return null;
      }
    });

    assertBlocks(f);
View Full Code Here

  public void testLocalClose() throws Exception {
    final OutputStream remoteOut = mockConnection.getSocketB()
        .getOutputStream();
    new ExecutionDataWriter(remoteOut);

    final TcpConnection con = new TcpConnection(
        mockConnection.getSocketA(), data);
    con.init();

    final Future<Void> f = executor.submit(new Callable<Void>() {
      public Void call() throws Exception {
        con.run();
        return null;
      }
    });

    assertBlocks(f);

    con.close();
    f.get();
  }
View Full Code Here

    data.setSessionId("stubid");

    final RemoteControlWriter remoteWriter = new RemoteControlWriter(
        mockConnection.getSocketB().getOutputStream());

    final TcpConnection con = new TcpConnection(
        mockConnection.getSocketA(), data);
    con.init();

    final Future<Void> f = executor.submit(new Callable<Void>() {
      public Void call() throws Exception {
        con.run();
        return null;
      }
    });

    assertBlocks(f);

    remoteWriter.visitDumpCommand(true, false);
    readAndAssertData();

    con.close();
    f.get();
  }
View Full Code Here

    data.getExecutionData(Long.valueOf(0x12345678), "Foo", 42);
    data.setSessionId("stubid");

    new RemoteControlWriter(mockConnection.getSocketB().getOutputStream());

    final TcpConnection con = new TcpConnection(
        mockConnection.getSocketA(), data);
    con.init();

    final Future<Void> f = executor.submit(new Callable<Void>() {
      public Void call() throws Exception {
        con.run();
        return null;
      }
    });

    assertBlocks(f);

    con.writeExecutionData(false);
    readAndAssertData();

    con.close();
    f.get();
  }
View Full Code Here

    f.get();
  }

  @Test
  public void testLocalDumpWithoutInit() throws Exception {
    final TcpConnection con = new TcpConnection(
        mockConnection.getSocketA(), data);
    // Must not write any data as we're not initialized:
    con.writeExecutionData(false);

    assertEquals(0, mockConnection.getSocketB().getInputStream()
        .available());
  }
View Full Code Here

    data.getExecutionData(Long.valueOf(123), "Foo", 1).getProbes()[0] = true;

    final RemoteControlWriter remoteWriter = new RemoteControlWriter(
        mockConnection.getSocketB().getOutputStream());

    final TcpConnection con = new TcpConnection(
        mockConnection.getSocketA(), data);
    con.init();

    final Future<Void> f = executor.submit(new Callable<Void>() {
      public Void call() throws Exception {
        con.run();
        return null;
      }
    });

    assertBlocks(f);

    remoteWriter.visitDumpCommand(false, true);

    final RemoteControlReader remoteReader = new RemoteControlReader(
        mockConnection.getSocketB().getInputStream());

    final ExecutionDataStore execStore = new ExecutionDataStore();
    remoteReader.setExecutionDataVisitor(execStore);
    final SessionInfoStore infoStore = new SessionInfoStore();
    remoteReader.setSessionInfoVisitor(infoStore);

    assertTrue(remoteReader.read());
    assertTrue(infoStore.getInfos().isEmpty());
    assertTrue(execStore.getContents().isEmpty());
    assertFalse(data.getExecutionData(Long.valueOf(123), "Foo", 1)
        .getProbes()[0]);

    con.close();
    f.get();
  }
View Full Code Here

TOP

Related Classes of org.jacoco.agent.rt.internal.output.TcpConnection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.