The community forums are in BETA and closed to the public.

PubNub callbacks missing

I am performing functional tests for my project in java.

PubNub is not making the callbacks when I try to subscribe or publish within the test method even though the connection is fine.

If I try to publish or subscribe to the channel from a separate java client, the callback works well.

public class FunctionalTest { private Logger logger = LoggerFactory.getLogger(FunctionalTest.class);

@Test
public void verifyCreateSuccess() throws JAXBException,IOException {

Pubnub pubnub = new Pubnub("publisher-key", "subscriber-key");

Callback callback = new Callback() {
   public void successCallback(String channel, Object response) {
       logger.info("PUBLISHER::" + response.toString());
   }
   public void errorCallback(String channel, PubnubError error) {
       logger.info("PUBLISHER::" + error.toString());
   } };  try {
   pubnub.publish("foo-test",new JSONObject().put("test", 1),callback);} catch (JSONException e) {
   e.printStackTrace();}}} 

Comments to this discussion are now closed!