Clone
 

alexey kachayev <kachayev@gmail.com> in Netty

Get rid of deprecated SslContext methods in handler-proxy tests

Motivation:

ProxyHandlerTest package uses deprecated methods SslContext.newServerContext and

SslContext.newClientContext.

Modifications:

SslContextBuilder is used to build server and client SslContext.

Result:

Less deprecated method in the code.

Fix random number generators in WebSocketUtil

Motivation:

Implementation of WebSocketUtil/randomNumber is incorrect and might violate

the API returning values > maximum specified.

Modifications:

* WebSocketUtil/randomNumber is reimplemented, the idea of the solution described

in the comment in the code

* Implementation of WebSocketUtil/randomBytes changed to nextBytes method

* PlatformDependet.threadLocalRandom is used instead of Math.random to improve efficiency

* Added test cases to check random numbers generator

* To ensure corretness, we now assert that min < max when generating random number

Result:

WebSocketUtil/randomNumber always produces correct result.

Covers https://github.com/netty/netty/issues/8023

Make results of handler proxy tests reproducible

Motivation:

`ProxyHandlerTest` relies on random values to run tests: first to

shuffle collection of test items and lately to set configuration

flag for `AUTO_READ`. While the purpose of randomization is clear,

it's still impossible to reproduce the same sequence of test cases

when something went wrong. For `AUTO_READ` it's even impossible

to tell what flag was set when the particular test failed.

Modifications:

* Test runner now log seed values that was used for shuffling,

so you can take one and put in your tests to "freeze" them

while debugging (pretty common approach with randomized tests)

* `SuccessItemTest` is split into 2 different use cases:

for AUTO_READ flag set to "on" and "off"

Result:

You can reproduce specific tests results now.

DnsAddressResolverGroup to use pluggable DnsNameResolverBuilder (#7793)

Motivation:

Right now to customize DNS name resolver when using DnsAddressResolverGroup

one should subclass implementation and override newNameResolver method when

in fact it's possible to collect all settings in a DnsNameResolverBuilder

instance. Described in #7749.

Modifications:

- Added new constructor for DnsNameResolverBuilder in order to delay

EventLoop specification

- Added copy() method to DnsNameResolverBuilder to provide an immutable

copy of the builder

- Added new single-argument constructor for DnsAddressResolverGroup and

RoundRobinDnsAddressResolverGroup accepting DnsNameResolverBuilder

instance

- DnsAddressResolverGroup to build a new resolver using DnsNameResolverBuilder

given instead of creating a new one

- Test cases to check that changing channelFactory after the builder was passed

to create a DnsNameResolverGroup would not propagate to the name resolver

Result:

Much easier to customize DNS settings w/o subclassing DnsAddressResolverGroup

PendingWriteQueue to handle write operations with void future

Motivation:

Right now PendingWriteQueue.removeAndWriteAll collects all promises to

PromiseCombiner instance which sets listener to each given promise throwing

IllegalStateException on VoidChannelPromise which breaks while loop

and "reports" operation as failed (when in fact part of writes might be

actually written).

Modifications:

Check if the promise is not void before adding it to the PromiseCombiner

instance.

Result:

PendingWriteQueue.removeAndWriteAll succesfully writes all pendings

even in case void promise was used.