Search in sources :

Example 1 with RejectedSetupException

use of io.rsocket.exceptions.RejectedSetupException in project spring-security by spring-projects.

the class RSocketMessageHandlerConnectionITests method connectWhenNotAuthorized.

@Test
public void connectWhenNotAuthorized() {
    UsernamePasswordMetadata credentials = new UsernamePasswordMetadata("evil", "password");
    // @formatter:off
    this.requester = requester().setupMetadata(credentials, UsernamePasswordMetadata.BASIC_AUTHENTICATION_MIME_TYPE).connectTcp(this.server.address().getHostName(), this.server.address().getPort()).block();
    assertThatExceptionOfType(Exception.class).isThrownBy(() -> this.requester.route("retrieve-mono").data("data").retrieveMono(String.class).block()).matches((ex) -> ex instanceof RejectedSetupException || ex.getClass().toString().contains("ReactiveException"));
// @formatter:on
// FIXME: https://github.com/rsocket/rsocket-java/issues/686
}
Also used : RejectedSetupException(io.rsocket.exceptions.RejectedSetupException) UsernamePasswordMetadata(org.springframework.security.rsocket.metadata.UsernamePasswordMetadata) Test(org.junit.jupiter.api.Test)

Aggregations

RejectedSetupException (io.rsocket.exceptions.RejectedSetupException)1 Test (org.junit.jupiter.api.Test)1 UsernamePasswordMetadata (org.springframework.security.rsocket.metadata.UsernamePasswordMetadata)1