Skip to content

Commit

Permalink
Minor code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
strangelookingnerd authored and ok2c committed Jun 27, 2024
1 parent ad1a20f commit bbfc47f
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public static void main(final String... args) throws Exception {
}
}

H2CompatibilityTest() throws Exception {
H2CompatibilityTest() {
this.client = H2RequesterBootstrap.bootstrap()
.setIOReactorConfig(IOReactorConfig.custom()
.setSoTimeout(TIMEOUT)
Expand All @@ -113,11 +113,11 @@ public static void main(final String... args) throws Exception {
.create();
}

void start() throws Exception {
void start() {
client.start();
}

void shutdown() throws Exception {
void shutdown() {
client.close(CloseMode.GRACEFUL);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

package org.apache.hc.core5.testing.extension.nio;

import java.io.IOException;
import java.util.function.Consumer;

import org.apache.hc.core5.http.impl.bootstrap.HttpAsyncServer;
Expand Down Expand Up @@ -85,7 +84,7 @@ public void afterEach(final ExtensionContext extensionContext) throws Exception
}
}

public HttpAsyncServer start() throws IOException {
public HttpAsyncServer start() {
Assertions.assertNotNull(server);
server.start();
return server;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

package org.apache.hc.core5.testing.extension.nio;

import java.io.IOException;
import java.util.function.Consumer;

import org.apache.hc.core5.http.impl.bootstrap.AsyncServerBootstrap;
Expand Down Expand Up @@ -83,7 +82,7 @@ public void afterEach(final ExtensionContext extensionContext) throws Exception
}
}

public HttpAsyncServer start() throws IOException {
public HttpAsyncServer start() {
Assertions.assertNotNull(server);
server.start();
return server;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void pushPromise(
})));

@RegisterExtension
private final HttpAsyncRequesterResource clientResource = new HttpAsyncRequesterResource((bootstrap) -> bootstrap
private final HttpAsyncRequesterResource clientResource = new HttpAsyncRequesterResource(bootstrap -> bootstrap
.setIOReactorConfig(IOReactorConfig.custom()
.setSoTimeout(TIMEOUT)
.build()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
package org.apache.hc.core5.testing.nio;

import java.net.InetSocketAddress;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicLong;
Expand Down Expand Up @@ -155,7 +154,7 @@ void testManyGetSessionFailures() throws Exception {
final H2MultiplexingRequester requester = clientResource.start();
final H2ConnPool connPool = requester.getConnPool();
final CountDownLatch latch = new CountDownLatch(n);
final ConcurrentLinkedQueue<Long> concurrentConnections = new ConcurrentLinkedQueue<>();

for (int i = 0; i < n; i++) {
connPool.getSession(target, TIMEOUT, new FutureCallback<IOSession>() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ abstract class H2ServerBootstrapFiltersTest {
private static final Timeout TIMEOUT = Timeout.ofMinutes(1);

@RegisterExtension
private final H2AsyncServerResource serverResource = new H2AsyncServerResource((bootstrap) -> bootstrap
private final H2AsyncServerResource serverResource = new H2AsyncServerResource(bootstrap -> bootstrap
.setVersionPolicy(HttpVersionPolicy.NEGOTIATE)
.setIOReactorConfig(
IOReactorConfig.custom()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@ class TestHeaderElement {
@Test
void testConstructor3() {
final HeaderElement element = new BasicHeaderElement("name", "value",
new NameValuePair[] {
new BasicNameValuePair("param1", "value1"),
new BasicNameValuePair("param2", "value2")
} );
new BasicNameValuePair("param1", "value1"),
new BasicNameValuePair("param2", "value2"));
Assertions.assertEquals("name", element.getName());
Assertions.assertEquals("value", element.getValue());
Assertions.assertEquals(2, element.getParameters().length);
Expand Down Expand Up @@ -82,10 +80,8 @@ void testParamByName() {
@Test
void testToString() {
final BasicHeaderElement element = new BasicHeaderElement("name", "value",
new NameValuePair[] {
new BasicNameValuePair("param1", "value1"),
new BasicNameValuePair("param2", "value2")
} );
new BasicNameValuePair("param1", "value1"),
new BasicNameValuePair("param2", "value2"));
Assertions.assertEquals("name=value; param1=value1; param2=value2", element.toString());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ void testRequestHttpHostHeaderNoPort() throws Exception {
}

@Test
void testRequestHttp11HostHeaderPresent() {
void testRequestHttp11HostHeaderPresent() throws Exception {
final HttpCoreContext context = HttpCoreContext.create();
final BasicClassicHttpRequest request = new BasicClassicHttpRequest(Method.GET, "/");
request.setHeader(HttpHeaders.HOST, "blah");
Expand Down

0 comments on commit bbfc47f

Please sign in to comment.