Package org.xsocket.connection

Examples of org.xsocket.connection.IDataHandler


                int available = ds.available();
                ByteBuffer[] data = ds.readByteBufferByLength(available);
               
                INonBlockingConnection con = registry.retrieveTcpConnection(channelId, 1000);
               
                IDataHandler dh = new IDataHandler() {
                  public boolean onData(INonBlockingConnection connection) throws IOException {
                        connection.resetToReadMark();
                        connection.markReadPosition();
                        int length = connection.readInt();
                        ByteBuffer[] data = connection.readByteBufferByLength(length);
View Full Code Here


        }
       

        public boolean onConnect(INonBlockingConnection connection) throws IOException {
           
            IDataHandler cannelIdReader = new IDataHandler() {
               
                public boolean onData(INonBlockingConnection connection) throws IOException {
                    Integer channelId = connection.readInt();
                   
                    registry.addTcpConnection(channelId, connection);
View Full Code Here


  @Test
  public void testFullMessage() throws Exception {

      IDataHandler dh = new IDataHandler() {
       
          public boolean onData(INonBlockingConnection con) throws IOException, BufferUnderflowException, ClosedChannelException, MaxReadSizeExceededException {
              con.readStringByDelimiter("\r\n\r\n");

              con.write("HTTP/1.1 200 OK\r\n" +
View Full Code Here


    @Test
    public void testFullMessageCloseDataSource() throws Exception {

        IDataHandler dh = new IDataHandler() {
         
            public boolean onData(INonBlockingConnection con) throws IOException, BufferUnderflowException, ClosedChannelException, MaxReadSizeExceededException {
                con.readStringByDelimiter("\r\n\r\n");

                con.write("HTTP/1.1 200 OK\r\n" +
View Full Code Here

   
    @Test
    public void testFullMessageDestroyDataSource() throws Exception {

        IDataHandler dh = new IDataHandler() {
         
            public boolean onData(INonBlockingConnection con) throws IOException, BufferUnderflowException, ClosedChannelException, MaxReadSizeExceededException {
                con.readStringByDelimiter("\r\n\r\n");

                con.write("HTTP/1.1 200 OK\r\n" +
View Full Code Here


    @Test
    public void testFullChunkedMessageServersideClose() throws Exception {

        IDataHandler dh = new IDataHandler() {
         
            public boolean onData(INonBlockingConnection con) throws IOException, BufferUnderflowException, ClosedChannelException, MaxReadSizeExceededException {
                con.readStringByDelimiter("\r\n\r\n");

                con.write("HTTP/1.1 200 OK\r\n" +
View Full Code Here

  @Test
  public void testFullMessageInsufficientData() throws Exception {
     
      System.out.println("testFullMessageInsufficientData");

      IDataHandler dh = new IDataHandler() {
           
            public boolean onData(INonBlockingConnection con) throws IOException, BufferUnderflowException, ClosedChannelException, MaxReadSizeExceededException {
                con.readStringByDelimiter("\r\n\r\n");

                con.write("HTTP/1.1 200 OK\r\n" +
View Full Code Here

 

  @Test
    public void testHeaderInsufficientData() throws Exception {

        IDataHandler dh = new IDataHandler() {
           
            public boolean onData(INonBlockingConnection con) throws IOException, BufferUnderflowException, ClosedChannelException, MaxReadSizeExceededException {
                con.readStringByDelimiter("\r\n\r\n");

                con.write("HTTP/1.1 2");
View Full Code Here

 

    @Test
    public void testHeaderInsufficientData2() throws Exception {

        IDataHandler dh = new IDataHandler() {
           
            public boolean onData(INonBlockingConnection con) throws IOException, BufferUnderflowException, ClosedChannelException, MaxReadSizeExceededException {
                con.readStringByDelimiter("\r\n\r\n");

                con.write("HTTP/1.1 200 OK\r\n" +
View Full Code Here


    @Test
    public void testHttp_0_9_response() throws Exception {

        IDataHandler dh = new IDataHandler() {
           
            public boolean onData(INonBlockingConnection con) throws IOException, BufferUnderflowException, ClosedChannelException, MaxReadSizeExceededException {
                con.readStringByDelimiter("\r\n\r\n");

                con.write("<ht");
View Full Code Here

TOP

Related Classes of org.xsocket.connection.IDataHandler

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.