Package etch.util

Examples of etch.util.FlexBuffer


  /** @throws Exception */
  @Test
  public void packet4() throws Exception
  {
    FlexBuffer buf = new FlexBuffer( new byte[]
    { VERSION, 2, 0, NONE } );
   
    session.msg_handled = false;
   
    m.sessionPacket( who, buf );
View Full Code Here


       
        buf.flip();
        byte[] bbuf = new byte[buf.remaining()];
        buf.get( bbuf );
       
        FlexBuffer fbuf = new FlexBuffer( bbuf );
        session.sessionData( null, fbuf );
      }
      finally
      {
        if (buf != null)
View Full Code Here

  @Test
  public void packet1() throws Exception
  {
    // Create empty packet to send
    assert p.headerSize() == 8;
    FlexBuffer buf = new FlexBuffer( new byte[]
    {
      // space for header:
      0, 0, 0, 0, 0, 0, 0, 0
        // packet data:
    } );
View Full Code Here

  @Test
  public void packet2() throws Exception
  {
    // Create 1 byte packet to send
    assert p.headerSize() == 8;
    FlexBuffer buf = new FlexBuffer( new byte[]
    {
      // space for header:
        0, 0, 0, 0, 0, 0, 0, 0,
        // packet data:
        1
View Full Code Here

  @Test
  public void packet3() throws Exception
  {
    // Create 2 byte packet to send
    assert p.headerSize() == 8;
    FlexBuffer buf = new FlexBuffer( new byte[]
    {
      // space for header:
        0, 0, 0, 0, 0, 0, 0, 0,
        // packet data:
        2, 3
View Full Code Here

  @Test( expected = IllegalArgumentException.class )
  public void packet4() throws Exception
  {
    // Create too-small packet to send
    assert p.headerSize() > 7;
    FlexBuffer buf = new FlexBuffer( new byte[]
    {
      // space for header:
      0, 0, 0, 0, 0, 0, 0 // too short!
        // packet data:
    } );
View Full Code Here

  @Test( expected = IllegalArgumentException.class )
  public void packet5() throws Exception
  {
    // Create too-small packet to send
    assert p.headerSize() > 0;
    FlexBuffer buf = new FlexBuffer( new byte[] {} );
    p.transportPacket( who, buf );
  }
View Full Code Here

  /** @throws Exception */
  @Test( expected = IOException.class )
  public void bad1() throws Exception
  {
    // Create data to send
    FlexBuffer buf = new FlexBuffer( new byte[]
    {
      // packet header:
      0, 0, 0, 0, 0, 0, 0, 0 // bad sig
        // packet data:
    } );
View Full Code Here

  /** @throws Exception */
  @Test( expected = IOException.class )
  public void bad2() throws Exception
  {
    // Create data to send
    FlexBuffer buf = new FlexBuffer( new byte[]
    {
      // packet header:
      1, 2, 3, 4, 0, 0, 0, 0 // bad sig
        // packet data:
    } );
View Full Code Here

  /** @throws Exception */
  @Test( expected = IOException.class )
  public void bad3() throws Exception
  {
    // Create data to send
    FlexBuffer buf = new FlexBuffer( new byte[]
    {
      // packet header:
      -34, -83, -66, -17, 0, 1, 0, 0 // size too big
        // packet data:
    } );
View Full Code Here

TOP

Related Classes of etch.util.FlexBuffer

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.