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


   

  @Test
  public void testNoCache() throws Exception {

      IDataHandler dh = new IDataHandler() {
       
          public boolean onData(INonBlockingConnection connection) throws IOException {
              connection.readStringByDelimiter("\r\n\r\n");
              connection.write("HTTP/1.1 302 Found\r\n" +
                               "Date: Wed, 23 Sep 2009 18:57:37 GMT\r\n" +
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 testCache() throws Exception {

        IDataHandler dh = new IDataHandler() {
         
            public boolean onData(INonBlockingConnection connection) throws IOException {
                connection.readStringByDelimiter("\r\n\r\n");
                connection.write("HTTP/1.1 302 Found\r\n" +
                                 "Date: Wed, 23 Sep 2009 18:57:37 GMT\r\n" +
View Full Code Here

   

  @Test
  public void testNoCache() throws Exception {

      IDataHandler dh = new IDataHandler() {
       
          public boolean onData(INonBlockingConnection connection) throws IOException {
              String header = connection.readStringByDelimiter("\r\n\r\n");
              connection.write("HTTP/1.1 302 Found\r\n" +
                               "Date: Wed, 23 Sep 2009 18:57:37 GMT\r\n" +
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 testCache() throws Exception {

        IDataHandler dh = new IDataHandler() {
         
            public boolean onData(INonBlockingConnection connection) throws IOException {
                String header = connection.readStringByDelimiter("\r\n\r\n");
                connection.write("HTTP/1.1 302 Found\r\n" +
                                 "Date: Wed, 23 Sep 2009 18:57:37 GMT\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

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.