Code example for ProtocolException

0
            method = POST;
        } 
 
        // If the request method is neither PUT or POST, then you're not writing 
        if (method != PUT && method != POST) {
            throw new ProtocolException("Can only write to PUT or POST");
        } 
 
        if (!connected) {
            // connect and see if there is cache available. 
            connect(); 
        } 
        return os = new ByteArrayOutputStream();
 
    } 
 
    public void setChunked(boolean chunked) {
        this.chunked = chunked;
    } 
 
    public boolean isChunked() {