@Test public void testSLFormattingInvalidInput() throws Exception { final CharArrayBuffer buf = new CharArrayBuffer(64); final StatusLine statusline = new StatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK"); try { this.formatter.formatStatusLine(null, statusline); Assert.fail("NullPointerException should habe been thrown"); } catch (final NullPointerException ex) { } try { this.formatter.formatStatusLine(buf, null); Assert.fail("NullPointerException should habe been thrown"); } catch (final NullPointerException ex) { } }
@Override public void formatStatusLine(final CharArrayBuffer buffer, final StatusLine statusLine) { Args.notNull(buffer, "Char array buffer"); Args.notNull(statusLine, "Status line"); formatProtocolVersion(buffer, statusLine.getProtocolVersion()); buffer.append(' '); buffer.append(Integer.toString(statusLine.getStatusCode())); buffer.append(' '); final String reasonPhrase = statusLine.getReasonPhrase(); if (reasonPhrase != null) { buffer.append(reasonPhrase); } }
BasicLineFormatter implements LineFormatter { @Override public void formatStatusLine(final CharArrayBuffer buffer, final StatusLine statusLine) { Args.notNull(buffer, "Char array buffer"); Args.notNull(statusLine, "Status line"); formatProtocolVersion(buffer, statusLine.getProtocolVersion()); buffer.append(' '); buffer.append(Integer.toString(statusLine.getStatusCode())); buffer.append(' '); final String reasonPhrase = statusLine.getReasonPhrase(); if (reasonPhrase != null) { buffer.append(reasonPhrase); } } }
BasicLineFormatter implements LineFormatter { @Override public void formatStatusLine(final CharArrayBuffer buffer, final StatusLine statusLine) { Args.notNull(buffer, "Char array buffer"); Args.notNull(statusLine, "Status line"); formatProtocolVersion(buffer, statusLine.getProtocolVersion()); buffer.append(' '); buffer.append(Integer.toString(statusLine.getStatusCode())); buffer.append(' '); final String reasonPhrase = statusLine.getReasonPhrase(); if (reasonPhrase != null) { buffer.append(reasonPhrase); } } BasicLineFormatter(); }
BasicLineFormatter implements LineFormatter { @Override public void formatStatusLine(final CharArrayBuffer buffer, final StatusLine statusLine) { Args.notNull(buffer, "Char array buffer"); Args.notNull(statusLine, "Status line"); formatProtocolVersion(buffer, statusLine.getProtocolVersion()); buffer.append(' '); buffer.append(Integer.toString(statusLine.getStatusCode())); buffer.append(' '); final String reasonPhrase = statusLine.getReasonPhrase(); if (reasonPhrase != null) { buffer.append(reasonPhrase); } } BasicLineFormatter(); @Override void formatRequestLine(final CharArrayBuffer buffer, final RequestLine reqline); @Override void formatStatusLine(final CharArrayBuffer buffer, final StatusLine statusLine); @Override void formatHeader(final CharArrayBuffer buffer, final Header header); }
BasicLineFormatter implements LineFormatter { @Override public void formatStatusLine(final CharArrayBuffer buffer, final StatusLine statusLine) { Args.notNull(buffer, "Char array buffer"); Args.notNull(statusLine, "Status line"); formatProtocolVersion(buffer, statusLine.getProtocolVersion()); buffer.append(' '); buffer.append(Integer.toString(statusLine.getStatusCode())); buffer.append(' '); final String reasonPhrase = statusLine.getReasonPhrase(); if (reasonPhrase != null) { buffer.append(reasonPhrase); } } BasicLineFormatter(); @Override void formatRequestLine(final CharArrayBuffer buffer, final RequestLine reqline); @Override void formatStatusLine(final CharArrayBuffer buffer, final StatusLine statusLine); @Override void formatHeader(final CharArrayBuffer buffer, final Header header); final static BasicLineFormatter INSTANCE; }