subscribeMethod.addRequestHeader(SubscribeMethod.H_NOTIFICATION_DELAY, String.valueOf(notificationDelay));
subscribeMethod.addRequestHeader(SubscribeMethod.H_SUBSCRIPTION_LIFETIME, String.valueOf(lifetime));
subscribeMethod.addRequestHeader(SubscribeMethod.H_DEPTH, ((depth == DepthSupport.DEPTH_INFINITY ) ? "infinity" : String.valueOf(depth)));
try {
subscribeMethod.setDoAuthentication(true);
HttpState httpState = new HttpState();
httpState.setCredentials(null, repositoryHost, credentials);
HttpConnection httpConnection = new HttpConnection(repositoryHost, repositoryPort, protocol);
httpConnection.setConnectionTimeout(CONNECTION_TIMEOUT);
int state = subscribeMethod.execute(httpState, httpConnection);
if ( state == HttpStatus.SC_OK ) {
String subscriptionId = subscribeMethod.getResponseHeader(SubscribeMethod.H_SUBSCRIPTION_ID).getValue();