Package org.apache.etch.util

Examples of org.apache.etch.util.FlexBuffer


   
    assertWhat( What.UP, dh.what );
    assertNull( dh.xsender );
    assertNull( dh.xbuf );
   
    c.transportData( null, new FlexBuffer( new byte[] { 21, 22, 23 } ) );
//    c.flush();
   
    assertEquals( 21, read( t ) );
    assertEquals( 22, read( t ) );
    assertEquals( 23, read( t ) );
View Full Code Here


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

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

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

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

  @Test @Ignore
  public void blah() throws Exception
  {
    assertEquals( What.UP, aph.what );
    assertEquals( What.UP, bph.what );
    FlexBuffer buf = new FlexBuffer();
    buf.put( 1 );
    buf.put( 2 );
    buf.put( 3 );
    buf.put( 4 );
    buf.put( 5 );
    buf.setIndex( 0 );
    ac.transportPacket( null, buf );
    Thread.sleep( 500 );
    assertEquals( What.PACKET, bph.what );
    assertNotNull( bph.xsender );
    assertNotSame( buf, bph.xbuf );
View Full Code Here

  @Test @Ignore
  public void blah() throws Exception
  {
    assertEquals( What.UP, aph.what );
    assertEquals( What.UP, bph.what );
    FlexBuffer buf = new FlexBuffer();
    buf.put( 1 );
    buf.put( 2 );
    buf.put( 3 );
    buf.put( 4 );
    buf.put( 5 );
    buf.setIndex( 0 );
    ac.transportPacket( null, buf );
    Thread.sleep( 500 );
    assertEquals( What.PACKET, bph.what );
    assertNotNull( bph.xsender );
    assertNotSame( buf, bph.xbuf );
View Full Code Here

  @Override
  protected void readSocket() throws Exception
  {
    final DatagramSocket s = checkSocket();
    // TODO allow buffer size to be specified.
    final FlexBuffer buf = new FlexBuffer( new byte[8192] );
    final DatagramPacket p = new DatagramPacket( new byte[0], 0 );
   
    try
    {
      while (isStarted())
      {
        p.setData( buf.getBuf() );
       
        s.receive( p );
       
        buf.setIndex( 0 );
        buf.setLength( p.getLength() );
       
        if (s.isConnected())
          session.sessionPacket( null, buf );
        else
          session.sessionPacket( getWho( p.getAddress(), p.getPort() ), buf );
View Full Code Here

TOP

Related Classes of org.apache.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.