Example usage for io.netty.handler.codec.http HttpHeaders toString

List of usage examples for io.netty.handler.codec.http HttpHeaders toString

Introduction

In this page you can find the example usage for io.netty.handler.codec.http HttpHeaders toString.

Prototype

@Override
    public String toString() 

Source Link

Usage

From source file:org.kaaproject.kaa.server.transports.http.transport.netty.RequestDecoderTest.java

License:Apache License

private HttpObject createHttpRequestMock(HttpMethod httpMethod, boolean isSuccessfulResult,
        Class requestClazz) {//from   ww  w.  j a  v  a  2  s. c o  m
    DecoderResult result = mock(DecoderResult.class);
    when(result.isSuccess()).thenReturn(isSuccessfulResult);
    HttpObject httpRequest = (HttpObject) mock(requestClazz);
    when(httpRequest.getDecoderResult()).thenReturn(result);
    HttpHeaders headers = mock(HttpHeaders.class);
    when(headers.toString()).thenReturn("Some header");
    if (requestClazz.equals(HttpRequest.class)) {
        when(((HttpRequest) httpRequest).getMethod()).thenReturn(httpMethod);
        when(((HttpRequest) httpRequest).headers()).thenReturn(headers);
    }
    return httpRequest;
}