Package org.neo4j.smack.pipeline.http

Examples of org.neo4j.smack.pipeline.http.HttpHeaderContainer


public class TestHttpHeaderContainer {

    @Test
    public void testAssignAndClear() {
        HttpHeaderContainer headers = new HttpHeaderContainer();
       
        headers.addHeader(HttpHeaderNames.CONTENT_LENGTH, new MutableString("0"));
        assertThat(headers.getHeaders(HttpHeaderNames.CONTENT_LENGTH).size(), is(1));
       
        headers.clear();
       
        assertThat(headers.getHeaders(HttpHeaderNames.CONTENT_LENGTH).size(), is(0));
    }
View Full Code Here


        assertThat(headers.getHeaders(HttpHeaderNames.CONTENT_LENGTH).size(), is(0));
    }
   
    @Test
    public void testInternalStorageGetsReused() {
        HttpHeaderContainer headers = new HttpHeaderContainer();
       
        headers.addHeader(HttpHeaderNames.CONTENT_LENGTH, new MutableString("0"));
        headers.addHeader(HttpHeaderNames.CONTENT_LENGTH, new MutableString("0"));
        headers.addHeader(HttpHeaderNames.CONTENT_LENGTH, new MutableString("0"));
        headers.addHeader(HttpHeaderNames.CONTENT_LENGTH, new MutableString("0"));
       
        int preClearCapacity = headers.getHeaders(HttpHeaderNames.CONTENT_LENGTH).currentCapacity();
       
        headers.clear();

        headers.addHeader(HttpHeaderNames.CONTENT_LENGTH, new MutableString("0"));
        headers.addHeader(HttpHeaderNames.CONTENT_LENGTH, new MutableString("0"));
        headers.addHeader(HttpHeaderNames.CONTENT_LENGTH, new MutableString("0"));
        headers.addHeader(HttpHeaderNames.CONTENT_LENGTH, new MutableString("0"));
       
        assertThat(headers.getHeaders(HttpHeaderNames.CONTENT_LENGTH).currentCapacity(), is(preClearCapacity));
    }
View Full Code Here

            {
                add(HttpHeaderNames.CONTENT_LENGTH);
            }
        }, 4000);
       
        HttpHeaderContainer headers = new HttpHeaderContainer();
       
        decoder.decode(buf, headers);
       
        assertThat(headers.getHeader(HttpHeaderNames.CONTENT_LENGTH), is(new MutableString("0")));
    }
View Full Code Here

                add(HttpHeaderNames.CONTENT_LENGTH);
                add(HttpHeaderNames.ACCEPT);
            }
        }, 4000);
       
        HttpHeaderContainer headers = new HttpHeaderContainer();
       
        decoder.decode(buf, headers);
       
        assertThat(headers.getHeaders(HttpHeaderNames.CONTENT_LENGTH).get(0), is(new MutableString("0")));
        assertThat(headers.getHeaders(HttpHeaderNames.CONTENT_LENGTH).get(1), is(new MutableString("4")));
       
        assertThat(headers.getHeader(HttpHeaderNames.ACCEPT), is(new MutableString("stuff")));
    }
View Full Code Here

                add(HttpHeaderNames.CONTENT_LENGTH);
                add(HttpHeaderNames.ACCEPT);
            }
        }, 4000);
       
        HttpHeaderContainer headers = new HttpHeaderContainer();
       
        decoder.decode(buf, headers);
       
        assertThat(headers.getHeaders(HttpHeaderNames.CONTENT_LENGTH).get(0), is(new MutableString("this is a multiline string")));
       
        assertThat(headers.getHeader(HttpHeaderNames.ACCEPT), is(new MutableString("stuff")));
    }
View Full Code Here

                add(HttpHeaderNames.CONTENT_LENGTH);
                add(HttpHeaderNames.ACCEPT);
            }
        }, 4000);
       
        HttpHeaderContainer headers = new HttpHeaderContainer();
       
        decoder.decode(buf, headers);
       
        assertThat(headers.getHeader(HttpHeaderNames.ACCEPT), is(new MutableString("stuff")));
    }
View Full Code Here

TOP

Related Classes of org.neo4j.smack.pipeline.http.HttpHeaderContainer

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.