use of com.couchbase.client.core.deps.io.netty.channel.embedded.EmbeddedChannel in project couchbase-jvm-clients by couchbase.
the class NonChunkedHttpMessageHandlerTest method setup.
@BeforeEach
void setup() {
endpoint = mock(BaseEndpoint.class);
EndpointContext endpointContext = mock(EndpointContext.class);
when(endpointContext.environment()).thenReturn(env);
when(endpointContext.authenticator()).thenReturn(PasswordAuthenticator.create("user", "pass"));
when(endpoint.context()).thenReturn(endpointContext);
channel = new EmbeddedChannel();
}
use of com.couchbase.client.core.deps.io.netty.channel.embedded.EmbeddedChannel in project couchbase-jvm-clients by couchbase.
the class AbstractKeyValueEmbeddedChannelTest method beforeEach.
@BeforeEach
protected void beforeEach() {
channel = new EmbeddedChannel();
eventBus = new SimpleEventBus(true);
}
use of com.couchbase.client.core.deps.io.netty.channel.embedded.EmbeddedChannel in project couchbase-jvm-clients by couchbase.
the class BaseEndpointTest method disconnectAfterBeingConnected.
/**
* This test tests the happy path, after being connected properly eventually a disconnect
* signal comes along.
*/
@Test
void disconnectAfterBeingConnected() {
EmbeddedChannel channel = new EmbeddedChannel();
InstrumentedEndpoint endpoint = connectSuccessfully(channel);
assertTrue(channel.isOpen());
assertTrue(channel.isActive());
endpoint.disconnect();
waitUntilCondition(() -> endpoint.state() == EndpointState.DISCONNECTED);
assertFalse(channel.isOpen());
assertFalse(channel.isActive());
assertEquals(2, eventBus.publishedEvents().size());
assertTrue(eventBus.publishedEvents().get(0) instanceof EndpointConnectedEvent);
assertTrue(eventBus.publishedEvents().get(1) instanceof EndpointDisconnectedEvent);
}
use of com.couchbase.client.core.deps.io.netty.channel.embedded.EmbeddedChannel in project couchbase-jvm-clients by couchbase.
the class PasswordAuthenticatorTest method ldapCompatibleOnlyEnablesPlain.
@Test
void ldapCompatibleOnlyEnablesPlain() {
PasswordAuthenticator authenticator = PasswordAuthenticator.ldapCompatible("user", "pass");
EndpointContext ctx = mock(EndpointContext.class);
when(ctx.environment()).thenReturn(ENV);
EmbeddedChannel channel = new EmbeddedChannel();
authenticator.authKeyValueConnection(ctx, channel.pipeline());
SaslAuthenticationHandler handler = channel.pipeline().get(SaslAuthenticationHandler.class);
assertEquals(EnumSet.of(SaslMechanism.PLAIN), handler.allowedMechanisms());
}
use of com.couchbase.client.core.deps.io.netty.channel.embedded.EmbeddedChannel in project couchbase-jvm-clients by couchbase.
the class PasswordAuthenticatorTest method allowsToEnablePlainInAddition.
@Test
void allowsToEnablePlainInAddition() {
PasswordAuthenticator authenticator = PasswordAuthenticator.builder().username("user").password("pass").enablePlainSaslMechanism().build();
EndpointContext ctx = mock(EndpointContext.class);
when(ctx.environment()).thenReturn(ENV);
EmbeddedChannel channel = new EmbeddedChannel();
authenticator.authKeyValueConnection(ctx, channel.pipeline());
SaslAuthenticationHandler handler = channel.pipeline().get(SaslAuthenticationHandler.class);
assertEquals(EnumSet.allOf(SaslMechanism.class), handler.allowedMechanisms());
}
Aggregations