@Test public void testFromMajorAndMinorReturnsConstants() { assertSame(HTTP_1_1, HttpProtocolVersion.of(1, 1)); assertSame(HTTP_1_0, HttpProtocolVersion.of(1, 0)); }
public static HttpProtocolVersion of(final int major, final int minor) { if (major == 1) { if (minor == 1) { return HTTP_1_1; } if (minor == 0) { return HTTP_1_0; } } else if (major == 2 && minor == 0) { return HTTP_2_0; } return new HttpProtocolVersion(major, minor); }
HttpProtocolVersion implements HttpProtocol { public static HttpProtocolVersion of(final int major, final int minor) { if (major == 1) { if (minor == 1) { return HTTP_1_1; } if (minor == 0) { return HTTP_1_0; } } else if (major == 2 && minor == 0) { return HTTP_2_0; } return new HttpProtocolVersion(major, minor); } }
HttpProtocolVersion implements HttpProtocol { public static HttpProtocolVersion of(final int major, final int minor) { if (major == 1) { if (minor == 1) { return HTTP_1_1; } if (minor == 0) { return HTTP_1_0; } } else if (major == 2 && minor == 0) { return HTTP_2_0; } return new HttpProtocolVersion(major, minor); } private  HttpProtocolVersion(final int major, final int minor); }
HttpProtocolVersion implements HttpProtocol { public static HttpProtocolVersion of(final int major, final int minor) { if (major == 1) { if (minor == 1) { return HTTP_1_1; } if (minor == 0) { return HTTP_1_0; } } else if (major == 2 && minor == 0) { return HTTP_2_0; } return new HttpProtocolVersion(major, minor); } private  HttpProtocolVersion(final int major, final int minor); static HttpProtocolVersion of(final int major, final int minor); int major(); int minor(); void writeTo(final Buffer buffer); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString(); @Override String name(); }
HttpProtocolVersion implements HttpProtocol { public static HttpProtocolVersion of(final int major, final int minor) { if (major == 1) { if (minor == 1) { return HTTP_1_1; } if (minor == 0) { return HTTP_1_0; } } else if (major == 2 && minor == 0) { return HTTP_2_0; } return new HttpProtocolVersion(major, minor); } private  HttpProtocolVersion(final int major, final int minor); static HttpProtocolVersion of(final int major, final int minor); int major(); int minor(); void writeTo(final Buffer buffer); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString(); @Override String name(); static final HttpProtocolVersion HTTP_1_1; static final HttpProtocolVersion HTTP_1_0; static final HttpProtocolVersion HTTP_2_0; }