@Test public void testOneAndHalfRequestWithoutEntity() throws ProtocolException { String req = "\r\nGET /s?wd=java+jdk7&rsv_bp=0&inputT=14326 HTTP/1.1\r\nHost: www.baidu.com\r\nUser-Agent: Mozilla/5.0 (Windows NT 6.1; rv:5.0) Gecko/20100101 Firefox/5.0\r\nAccept: text/html,application/xhtml+xml,\r"; List<HttpRequest> reqs = decoder.decode(req.getBytes(charset)); Assert.assertEquals(0, reqs.size()); req = "\n\tapplication/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: zh-cn,zh;q=0.5\r\nAccept-Encoding: gzip, deflate\r\nAccept-Charset: GB2312,utf-8;q=0.7,*;q=0.7\r\nConnection: keep-alive\r\nReferer: http: reqs = decoder.decode(req.getBytes(charset)); Assert.assertEquals(1, reqs.size()); LOG.debug("[CRAFT-ATOM-PROTOCOL-HTTP] Encoded request={}", new String(encoder.encode(reqs.get(0)), charset)); req = "\nAccept-Language: zh-cn,zh;q=0.5\r\n\r\n"; reqs = decoder.decode(req.getBytes(charset)); Assert.assertEquals(1, reqs.size()); LOG.debug("[CRAFT-ATOM-PROTOCOL-HTTP] Encoded request={}", new String(encoder.encode(reqs.get(0)), charset)); System.out.println(String.format("[CRAFT-ATOM-PROTOCOL-HTTP] (^_^) <%s> Case -> test one and half request without entity. ", CaseCounter.incr(3))); }
@Override public List<HttpRequest> decode(byte[] bytes) throws ProtocolException { try { return decode0(bytes); } catch (Exception e) { clear(); resetIndex(); if (e instanceof ProtocolException) { throw (ProtocolException) e; } throw new ProtocolException(e); } }
HttpRequestDecoder extends HttpDecoder<HttpRequest> implements ProtocolDecoder<HttpRequest> { @Override public List<HttpRequest> decode(byte[] bytes) throws ProtocolException { try { return decode0(bytes); } catch (Exception e) { clear(); resetIndex(); if (e instanceof ProtocolException) { throw (ProtocolException) e; } throw new ProtocolException(e); } } }
HttpRequestDecoder extends HttpDecoder<HttpRequest> implements ProtocolDecoder<HttpRequest> { @Override public List<HttpRequest> decode(byte[] bytes) throws ProtocolException { try { return decode0(bytes); } catch (Exception e) { clear(); resetIndex(); if (e instanceof ProtocolException) { throw (ProtocolException) e; } throw new ProtocolException(e); } } HttpRequestDecoder();  HttpRequestDecoder(Charset charset);  HttpRequestDecoder(Charset charset, int defaultBufferSize);  HttpRequestDecoder(Charset charset, int defaultBufferSize, int maxLineLength);  HttpRequestDecoder(Charset charset, int defaultBufferSize, int maxLineLength, int maxRequestSize); }
HttpRequestDecoder extends HttpDecoder<HttpRequest> implements ProtocolDecoder<HttpRequest> { @Override public List<HttpRequest> decode(byte[] bytes) throws ProtocolException { try { return decode0(bytes); } catch (Exception e) { clear(); resetIndex(); if (e instanceof ProtocolException) { throw (ProtocolException) e; } throw new ProtocolException(e); } } HttpRequestDecoder();  HttpRequestDecoder(Charset charset);  HttpRequestDecoder(Charset charset, int defaultBufferSize);  HttpRequestDecoder(Charset charset, int defaultBufferSize, int maxLineLength);  HttpRequestDecoder(Charset charset, int defaultBufferSize, int maxLineLength, int maxRequestSize); @Override List<HttpRequest> decode(byte[] bytes); }
HttpRequestDecoder extends HttpDecoder<HttpRequest> implements ProtocolDecoder<HttpRequest> { @Override public List<HttpRequest> decode(byte[] bytes) throws ProtocolException { try { return decode0(bytes); } catch (Exception e) { clear(); resetIndex(); if (e instanceof ProtocolException) { throw (ProtocolException) e; } throw new ProtocolException(e); } } HttpRequestDecoder();  HttpRequestDecoder(Charset charset);  HttpRequestDecoder(Charset charset, int defaultBufferSize);  HttpRequestDecoder(Charset charset, int defaultBufferSize, int maxLineLength);  HttpRequestDecoder(Charset charset, int defaultBufferSize, int maxLineLength, int maxRequestSize); @Override List<HttpRequest> decode(byte[] bytes);  }