protected void handle()

in folsom/src/main/java/com/spotify/folsom/client/ascii/StatsRequest.java [54:70]


  protected void handle(final AsciiResponse response, final HostAndPort server) throws IOException {
    final AsciiResponse.Type type = response.type;
    final String host = server.getHostText() + ":" + server.getPort();
    if (type == AsciiResponse.Type.STATS) {
      final StatsAsciiResponse statsResponse = (StatsAsciiResponse) response;
      succeed(ImmutableMap.of(host, new MemcachedStats(statsResponse.values)));
    } else if (type == AsciiResponse.Type.ERROR) {
      succeed(ImmutableMap.of(host, new MemcachedStats(ImmutableMap.of())));
    } else if (type == AsciiResponse.Type.CLIENT_ERROR) {
      MemcacheAuthenticationException exception =
          new MemcacheAuthenticationException(
              "Authentication required by server. Client not authenticated.");
      fail(exception, server);
    } else {
      throw new IOException("Unexpected response type: " + type);
    }
  }