private void sendAndReceive(BlockingChannel channel) throws Exception {
    long blobSize = 1028;
    byte[] bytesToSend = new byte[(int) blobSize];
    new Random().nextBytes(bytesToSend);
    ByteBuffer byteBufferToSend = ByteBuffer.wrap(bytesToSend);
    byteBufferToSend.putLong(0, blobSize);
    BoundedByteBufferSend bufferToSend = new BoundedByteBufferSend(byteBufferToSend);
    // send request
    channel.connect();
    channel.send(bufferToSend);
    // receive response
    DataInputStream streamResponse = channel.receive().getInputStream();
    byte[] bytesReceived = new byte[(int) blobSize - 8];
    streamResponse.readFully(bytesReceived);
    for (int i = 0; i < blobSize - 8; i++) {
      Assert.assertEquals(bytesToSend[8 + i], bytesReceived[i]);
    }
  }
Run only once for all tests
ambry-network/src/test/java/com/github/ambry/network/SSLBlockingChannelTest.java