Examples of TcpConnection


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

  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

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

  /**
   * 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

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

  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

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

    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

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

    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

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

    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

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

    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

Examples of org.springframework.integration.ip.tcp.connection.TcpConnection

        assertEquals("Mismatched label", op.getLabel() + " " + uri, desc.getLabel());
        return desc;
    }

    private Operation assertConnectionOperation(ConnectionFactory factory) throws Exception {
        TcpConnection conn = factory.getConnection();
        Operation op = assertConnectionOperation(conn);
        assertEquals("Mismatched label", conn.getClass().getSimpleName() + "#getConnection", op.getLabel());
        return op;
    }
View Full Code Here

Examples of org.springframework.integration.ip.tcp.connection.TcpConnection

        if (!(returnValue instanceof TcpConnection)) {
            return; // not expecting anything else, but let's no belabor the
            // point...
        }

        TcpConnection conn = (TcpConnection) returnValue;
        String host = conn.getHostAddress();
        int port = conn.getPort();
        op.put(HOST_ADDRESS_ATTR, host)
                .put(PORT_ATTR, port)
                .put(OperationFields.URI, "tcp://" + host + ":" + port)
                .putAnyNonEmpty(CONNID_ATTR, conn.getConnectionId())
                .put(SERVER_ATTR, conn.isServer());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.