Create bucket with on non default port through java api

For some reason java api to insertBucket hardcodes authType to sasl.

Setting port passed by user in bucket settings is irrelevant after this, since buckets with sasl authType are always created with fixed port.

Why is sasl authType hardcoded there ?

The main reason is that the port setting really sets up server side moxi. With the Java client, we don’t use moxi-- we go directly to the port and sasl auth. That’s actually be the preferred method since about Couchbase 1.8 back in 2011.

Do you still use server side moxi? If so, what client requires you to use it?

Sorry, I am not familiar with moxi, but I guess you mean that bucket create will succeed but any further operations on it will fail.
IMHO with SDK it generally should be possible to create any bucket which can be created from UI or CLI.

Mainly what I mean is that Couchbase’s support for setting the port number on a bucket is probably not doing what you think it is doing. When you configure this, it’s running a proxy for clients that don’t know how to do authentication. It’s a deprecated, non-recommended feature, so there is no reason to add SDK support for configuring it.