title: Coap Example For Observe is not working in Eclipse
body: <p>I am working on COAP for transfer information between devices. I am only in
  learning stage.I referred a document which have implemented the COAP sample 
  in eclipse by using californium. In that, I tried the example provided in the 
  document to observe the server states continuously, but it is not working in 
  it just shows null pointer exception while I am running the project. Then I tried to debug the code for what is the reason for null pointer exception, it is 
  running good its getting the result continuously, I don't understand why it is 
  producing error during running the project but during debug its not. Please help </p>
  
  <p>The code I am using is:  </p>
  
  <pre><code>public class HelloObserver {
  
      public static void main(String[] args) {
           CoapClient client = new CoapClient("coap://vs0.inf.ethz.ch:5683/obs");
  
           CoapObserveRelation relation=    client.observe(new CoapHandler() {
  
  
                  @Override
                  public void onLoad(CoapResponse response) {
  
                      System.out.println(response.getResponseText());
                      /*response.notify();*/
                      // TODO Auto-generated method stub
  
                  }
  
                  @Override
                  public void onError() {
                      System.err.println();
                      // TODO Auto-generated method stub
  
                  }
              });
  
           relation.proactiveCancel();
      }
  
  }
  </code></pre>