Java-dcp-client throw NullPointerException when SSL is enabled

I try to use SSL between DCP client and couchbase server, with a minimum test client code. Got NPE in connection initialization. It works fine when SSL parameters are commented out.
I know that dcp client is still work in progress. Has anyone managed to use SSL or is it known not to work?
DCP Client version 0.12.0
Core IO version 1.5.3
Java SDK version 2.5.3
Server 5.0.0

Stack trace of NPE is
Exception in thread “main” java.lang.NullPointerException
at com.couchbase.client.dcp.conductor.Conductor.masterChannelByPartition(
at com.couchbase.client.dcp.conductor.Conductor.access$6(
at com.couchbase.client.dcp.conductor.Conductor$
at com.couchbase.client.dcp.conductor.Conductor$
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(
at rx.internal.util.ScalarSynchronousObservable$WeakSingleProducer.request(
at rx.Subscriber.setProducer(

in my debug I see that client received config from server


Then a copy of NodeInfo without sslService is first created, then another instance with sslService is created in AbstractBucketConfig constructor. However when Conductor code throws NPE

NodeInfo node = config.nodeAtIndex(index);
for (DcpChannel ch : channels) {
InetSocketAddress address = new InetSocketAddress(node.hostname().nameOrAddress(),
(env.sslEnabled() ? node.sslServices() :;

config.nodeAtIndex(index) call returns the NodeInfo instance without sslService, causing a null in map get.

The code of managing configuratin is in core-io, not in dcp client.
So is there a bug in java client core code or how dcp client use it?

My test client is

public class DCPClient {

public static void main(String[] args) throws InterruptedException {
    // Connect to localhost and use the travel-sample bucket
    final Client client = Client.configure()

    // Don't do anything with control events in this example
    client.controlEventHandler(new ControlEventHandler() {
        public void onEvent(ChannelFlowController flowController, ByteBuf event) {

    // Print out Mutations and Deletions
    client.dataEventHandler(new DataEventHandler() {
        public void onEvent(ChannelFlowController flowController, ByteBuf event) {
            if ( {
                System.out.println("Mutation: " + DcpMutationMessage.toString(event));
                // You can print the content via DcpMutationMessage.content(event).toString(CharsetUtil.UTF_8);
            } else if ( {
                System.out.println("Deletion: " + DcpDeletionMessage.toString(event));

    // Connect the sockets

    // Initialize the state (start now, never stop)
    client.initializeState(StreamFrom.NOW, StreamTo.INFINITY).await();

    // Start streaming on all partitions

    // Sleep for some time to print the mutations
    // The printing happens on the IO threads!

    // Once the time is over, shutdown.


Hi Shen Jin,

Thank you for the bug report and thorough investigation. Since the Java SDK (also built on the core IO library) uses SSL without any problem, this is probably a bug in the DCP client. I’ve filed to track the issue.

In the mean time, if you decide to continue investigating, let us know what you discover. And of course, pull requests are always welcome.


1 Like

Just following up. We’re planning to modify the core IO library so the NodeInfo returned by config.nodeAtIndex will contain info for the SSL services. It’s looking like this fix will be included in next release of the core IO library.

The proposed code change: