const Hapi = require('hapi');

const server = new Hapi.Server();
server.connection({
  port: 3000
});

server.register({
    register: require('../index.js'),
    options: {
        timeout: 4000
    }
}, function (err) {
  console.log('registered', err);
});

server.route({
  method: 'GET',
  path: '/',
  handler: function(request, reply) {
    setTimeout(() => {
      reply('Hello, world!');
    }, 2000);
  }
});

server.start((err) => {

  if (err) {
    throw err;
  }
  console.log('Server running at:', server.info.uri);
});

@@ -59,31 +59,12 @@
 ver(
-);%0Aserver.connection(
 %7B%0A
+  
   po
@@ -181,27 +181,28 @@
  %7D%0A%7D
-, function (err) %7B%0A
+).then((err) =%3E %7B%0A  
   co
@@ -294,18 +294,8 @@
 dler
-: function
 (req
@@ -304,17 +304,15 @@
 st, 
-reply
+h
 ) %7B%0A
+  
     
@@ -340,14 +340,17 @@
     
-reply(
+  return 
 'Hel
@@ -360,19 +360,20 @@
  world!'
-)
 ;%0A
+  
     %7D, 2
@@ -404,52 +404,25 @@
 art(
-(err
+).then((
 ) =%3E %7B%0A
-%0A
   
-if (err) %7B%0A    throw err;%0A  %7D%0A
   co
@@ -471,12 +471,47 @@
 o.uri);%0A
+%7D).catch((err) =%3E %7B%0A    throw err;%0A
 %7D);%0A

update test server to hapi 17 with promises