use of org.springframework.boot.rsocket.server.RSocketServerCustomizer in project spring-boot by spring-projects.
the class NettyRSocketServerFactoryTests method serverCustomizers.
@Test
void serverCustomizers() {
NettyRSocketServerFactory factory = getFactory();
RSocketServerCustomizer[] customizers = new RSocketServerCustomizer[2];
for (int i = 0; i < customizers.length; i++) {
customizers[i] = mock(RSocketServerCustomizer.class);
will((invocation) -> invocation.getArgument(0)).given(customizers[i]).customize(any(io.rsocket.core.RSocketServer.class));
}
factory.setRSocketServerCustomizers(Arrays.asList(customizers));
this.server = factory.create(new EchoRequestResponseAcceptor());
InOrder ordered = inOrder((Object[]) customizers);
for (RSocketServerCustomizer customizer : customizers) {
ordered.verify(customizer).customize(any(io.rsocket.core.RSocketServer.class));
}
}
use of org.springframework.boot.rsocket.server.RSocketServerCustomizer in project spring-boot by spring-projects.
the class RSocketSecurityAutoConfigurationTests method autoConfigurationAddsCustomizerForServerRSocketFactory.
@Test
void autoConfigurationAddsCustomizerForServerRSocketFactory() {
RSocketServer server = RSocketServer.create();
this.contextRunner.run((context) -> {
RSocketServerCustomizer customizer = context.getBean(RSocketServerCustomizer.class);
customizer.customize(server);
server.interceptors((registry) -> registry.forSocketAcceptor((interceptors) -> {
assertThat(interceptors).isNotEmpty();
assertThat(interceptors).anyMatch((interceptor) -> interceptor instanceof SecuritySocketAcceptorInterceptor);
}));
});
}
Aggregations